-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added scraping of FB users places lived
- Loading branch information
1 parent
da98a7a
commit bdef6dc
Showing
5 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import csv | ||
import sys | ||
from tqdm import tqdm | ||
|
||
from minet.facebook import FacebookMobileScraper | ||
|
||
scraper = FacebookMobileScraper(cookie="firefox") | ||
|
||
USERS_URL = [ | ||
'https://www.facebook.com/cyr.esseh', | ||
'https://www.facebook.com/akim.malonga', | ||
'https://www.facebook.com/sarah.matoko', | ||
'https://www.facebook.com/chrismonick', | ||
'https://www.facebook.com/mavie.coeurmbeye', | ||
'https://www.facebook.com/clement.tsith', | ||
# 'https://www.facebook.com/johnny.levey.5', | ||
# 'https://www.facebook.com/profile.php?id=100004392515502', | ||
# 'https://www.facebook.com/blaidynson', | ||
# 'https://www.facebook.com/fabien.Cydel', | ||
# 'https://www.facebook.com/xavierdestaing.baboueya', | ||
# 'https://www.facebook.com/beaugarel.malonga', | ||
# 'https://www.facebook.com/cedric.mabiala.714', | ||
# 'https://www.facebook.com/gracedaisy.londa', | ||
# 'https://www.facebook.com/aichath.tidjani.35', | ||
# 'https://www.facebook.com/profile.php?id=100022219963045', | ||
# 'https://www.facebook.com/zadkiel.esuszico', | ||
# 'https://www.facebook.com/claude.bikoulou.7', | ||
# 'https://www.facebook.com/sheila.mabiala.1' | ||
] | ||
|
||
for url in USERS_URL: | ||
print(scraper.user_places_lived_info(url)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# ============================================================================= | ||
# Minet Facebook User Places Lived CLI Action | ||
# ============================================================================= | ||
# | ||
# Logic of the `fb user-places-lived` action. | ||
# | ||
from minet.cli.utils import with_enricher_and_loading_bar | ||
from minet.cli.facebook.utils import with_facebook_fatal_errors | ||
from minet.facebook import FacebookMobileScraper | ||
from minet.facebook.types import MobileFacebookUserPlacesLived | ||
from minet.facebook.exceptions import FacebookInvalidTargetError | ||
|
||
|
||
@with_facebook_fatal_errors | ||
@with_enricher_and_loading_bar( | ||
headers=MobileFacebookUserPlacesLived, title="Finding places lived", unit="users" | ||
) | ||
def action(cli_args, enricher, loading_bar): | ||
scraper = FacebookMobileScraper(cli_args.cookie, throttle=cli_args.throttle) | ||
|
||
for i, row, user_url in enricher.enumerate_cells( | ||
cli_args.column, with_rows=True, start=1 | ||
): | ||
with loading_bar.step(): | ||
places_lived = scraper.user_places_lived_info(user_url) | ||
print(row) | ||
enricher.writerow(row, places_lived.as_csv_row() if places_lived is not None else None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters