Skip to content

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
@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