-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from hotessy/master
made changes
- Loading branch information
Showing
9 changed files
with
224 additions
and
298 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 |
---|---|---|
@@ -1,5 +1,9 @@ | ||
.DS_Store | ||
posts.txt | ||
cursor.txt | ||
.ipynb_checkpoints | ||
.ipynb_checkpoints/ | ||
__pycache__/ | ||
try.ipynb | ||
.idea | ||
data/ | ||
*.log |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,14 @@ | ||
## Usage | ||
|
||
``` | ||
python scraper.py [-h] [--dir DIR] --max MAX_DATE --min MIN_DATE --location LOCATION | ||
[--restore-cursor] [--log-level LOG_LEVEL] | ||
``` | ||
|
||
### Example | ||
1. Standard: `python scraper.py --max "2020/07/15" --min "2020/06/15" --location "New-York-City"` | ||
2. Custom directory: `python scraper.py --dir "./data" --max "2020/07/15" --min "2020/06/15" --location "New-York-City | ||
" --restore-cursor` | ||
3. Log debug messages: `python scraper.py --max "2020/07/15" --min "2020/06/15" --location "New-York-City" -- log-level | ||
10` | ||
4. Restore from last saved post: `python scraper.py --max "2020/07/15" --min "2020/06/15" --location "New-York-City" --restore-cursor` |
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 |
---|---|---|
@@ -1,42 +1,47 @@ | ||
#Instagram Time ID converter | ||
# Instagram Time ID converter | ||
|
||
import datetime | ||
print('hello') | ||
|
||
def get_location()->str: | ||
return input('Enter the URL of the location (for example: https://www.instagram.com/explore/locations/95099702/mgm-grand-las-vegas/)') | ||
def get_date()-> str: | ||
return input('Enter the date in this form: 1999/7/27... (leave no zeros in front of single digit months/days)') | ||
|
||
|
||
def get_location() -> str: | ||
return input( | ||
'Enter the URL of the location (for example: https://www.instagram.com/explore/locations/95099702/mgm-grand-las-vegas/)') | ||
|
||
|
||
def get_date() -> str: | ||
return input('Enter the date in this form: 1999/7/27... (leave no zeros in front of single digit months/days)') | ||
|
||
|
||
def date_str_2_dateobj(date: str) -> datetime.datetime: | ||
d_list = date.split("/") | ||
return datetime.datetime(int(d_list[0]), int(d_list[1]), int(d_list[2]), 23, 59, 59) | ||
|
||
def date_2_unix(date_obj: datetime.date)-> int: | ||
unixdate = date_obj - datetime.datetime(1970,1,1) | ||
mstime = int(unixdate.total_seconds() * 1000.0) | ||
insta_epoch = mstime - 1314220021300 | ||
return insta_epoch | ||
|
||
def binary_decimal_convert(bindec: tuple)-> int: | ||
# print(bin(bindec[1])) | ||
if bindec[0]: | ||
return int(bin(bindec[1])[2:]) | ||
else: | ||
return int(bindec[1], 2) | ||
|
||
def binary_lengthen(binary: int)-> int: | ||
zeroes = 41 - len(str(binary)) | ||
six_fourbit = ('0' * zeroes) + str(binary) + ('0' * 23) | ||
return six_fourbit | ||
d_list = date.split("/") | ||
return datetime.datetime(int(d_list[0]), int(d_list[1]), int(d_list[2]), 23, 59, 59) | ||
|
||
def run(date): | ||
# location_url = get_location() | ||
unix_time = date_2_unix(date_str_2_dateobj(date)) | ||
newbin = binary_decimal_convert((True, unix_time)) | ||
longbin = binary_lengthen(newbin) | ||
final_num = binary_decimal_convert((False, longbin)) | ||
return str(final_num) | ||
|
||
def date_2_unix(date_obj: datetime.date) -> int: | ||
unixdate = date_obj - datetime.datetime(1970, 1, 1) | ||
mstime = int(unixdate.total_seconds() * 1000.0) | ||
insta_epoch = mstime - 1314220021300 | ||
return insta_epoch | ||
|
||
# print(run()) | ||
|
||
def binary_decimal_convert(bindec: tuple) -> int: | ||
# print(bin(bindec[1])) | ||
if bindec[0]: | ||
return int(bin(bindec[1])[2:]) | ||
else: | ||
return int(bindec[1], 2) | ||
|
||
|
||
def binary_lengthen(binary: int) -> int: | ||
zeroes = 41 - len(str(binary)) | ||
six_fourbit = ('0' * zeroes) + str(binary) + ('0' * 23) | ||
return six_fourbit | ||
|
||
|
||
def run(date): | ||
# location_url = get_location() | ||
unix_time = date_2_unix(date_str_2_dateobj(date)) | ||
newbin = binary_decimal_convert((True, unix_time)) | ||
longbin = binary_lengthen(newbin) | ||
final_num = binary_decimal_convert((False, longbin)) | ||
return str(final_num) |
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,54 @@ | ||
{ | ||
"Minneapolis": "214063175", | ||
"New-York-City": "486560663", | ||
"Los-Angeles": "212999109", | ||
"Los-Angeles-Hollywood": "226233904", | ||
"Chicago": "204517928", | ||
"Chicago-Downtown": "244157761", | ||
"Houston": "212962809", | ||
"Phoenix": "211529586", | ||
"Philadelphia": "214228753", | ||
"San-Antonio": "212945639", | ||
"San-Diego": "212983635", | ||
"Dallas": "212900916", | ||
"San-Jose": "213070948", | ||
"Austin": "212964995", | ||
"Fort-Worth": "214001058", | ||
"Columbus, GA": "219362155", | ||
"Columbus, OH": "215824708", | ||
"Charlotte": "213141085", | ||
"San-Francisco": "44961364", | ||
"Seattle": "213941548", | ||
"Denver": "4599325", | ||
"Washington": "402206457", | ||
"Washington D.C.": "213480180", | ||
"Boston": "206698624", | ||
"Nashville-Downtown": "48918239", | ||
"Nashville": "213213692", | ||
"Oklahoma City": "213235913", | ||
"Oklahoma": "469882534", | ||
"Portland, OR": "107711604", | ||
"Portland, ME": "10099015", | ||
"Las-Vegas": "212901056", | ||
"Memphis": "215262999", | ||
"Louisville": "113226037", | ||
"Baltimore": "507294", | ||
"Milwaukee": "651007421", | ||
"Albuquerque": "214566258", | ||
"Tucson": "213215421", | ||
"Fresno": "213429027", | ||
"Sacramento": "212931804", | ||
"Atlanta-Downtown": "216249274", | ||
"Atlanta": "212947533", | ||
"Kansas-City": "213970592", | ||
"Colorado-Springs": "106270412737566", | ||
"Omaha": "214530463", | ||
"Raleigh": "213295703", | ||
"Miami": "212941492", | ||
"Long-Beach": "213193724", | ||
"Virginia": "375992293", | ||
"Oakland": "213051194", | ||
"Tulsa": "222331593", | ||
"Tampa": "213124046", | ||
"New-Orleans": "213424196" | ||
} |
Oops, something went wrong.