Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/faucet: switch Facebook auth over to mobile site #22137

Merged
merged 1 commit into from
Jan 7, 2021

Conversation

karalabe
Copy link
Member

@karalabe karalabe commented Jan 7, 2021

The full website uses AJAX. Switch over to the mobile site for scraping the infos.

@karalabe karalabe added this to the 1.10.0 milestone Jan 7, 2021
cmd/faucet/faucet.go Outdated Show resolved Hide resolved
cmd/faucet/faucet.go Outdated Show resolved Hide resolved
@holiman
Copy link
Contributor

holiman commented Jan 7, 2021

How about adding cmd/faucet/faucet_test.go:

package main

import (
	"fmt"
	"testing"

	"github.com/ethereum/go-ethereum/common"
)

func TestFacebook(t *testing.T) {
	for _, tt := range []struct {
		url  string
		want common.Address
	}{
		{
			"https://www.facebook.com/ambreen.fatimah.1/posts/781618749097122",
			common.HexToAddress("0x956Bcb03a6f8Df9566C7b300E35A21571e30c559"),
		},
	} {
		_, _, gotAddress, err := authFacebook(tt.url)
		if err != nil {
			t.Fatal(err)
		}
		if gotAddress != tt.want {
			t.Fatalf("address wrong, have %v want %v", gotAddress, tt.want)
		}
	}
}

@holiman
Copy link
Contributor

holiman commented Jan 7, 2021

( the reason I haven't pushed it as a commit, is that it would be better to use facebook-posts that aren't just random people, but people who are already affiliated with go-ethereum. I don't have a FB account personally... Although, hold on, I do have an account or two..)

@holiman
Copy link
Contributor

holiman commented Jan 7, 2021

Ok, this one should work:

package main

import (
	"testing"

	"github.com/ethereum/go-ethereum/common"
)

func TestFacebook(t *testing.T) {
	for _, tt := range []struct {
		url  string
		want common.Address
	}{
		{
			"https://www.facebook.com/fooz.gazonk/posts/2837228539847129",
			common.HexToAddress("0xDeadDeaDDeaDbEefbEeFbEEfBeeFBeefBeeFbEEF"),
		},
	} {
		_, _, gotAddress, err := authFacebook(tt.url)
		if err != nil {
			t.Fatal(err)
		}
		if gotAddress != tt.want {
			t.Fatalf("address wrong, have %v want %v", gotAddress, tt.want)
		}
	}
}

@karalabe
Copy link
Member Author

karalabe commented Jan 7, 2021

@holiman PTAL

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants