Skip to content

Commit

Permalink
[instagram] let's go
Browse files Browse the repository at this point in the history
  • Loading branch information
soimort committed Dec 10, 2018
1 parent 8454f87 commit c90a44c
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/you_get/extractors/instagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@ def instagram_download(url, output_dir='.', merge=True, info_only=False, **kwarg
image_url = edge['node']['display_url']
if 'video_url' in edge['node']:
image_url = edge['node']['video_url']
image_url = image_url.split('?')[0] # (not here: '?_nc_ht=instagram.fcph1-1.fna.fbcdn.net')
ext = image_url.split('.')[-1]
size = int(get_head(image_url)['Content-Length'])
try:
image_url = image_url.split('?')[0]
ext = image_url.split('.')[-1]
size = int(get_head(image_url)['Content-Length'])
except:
image_url = image_url.split('?')[0] + '?_nc_ht=instagram.fcph1-1.fna.fbcdn.net'
ext = image_url.split('.')[-1]
size = int(get_head(image_url)['Content-Length'])
print_info(site_info, title, ext, size)
if not info_only:
download_urls(urls=[image_url],
Expand All @@ -44,9 +49,14 @@ def instagram_download(url, output_dir='.', merge=True, info_only=False, **kwarg
image_url = info['entry_data']['PostPage'][0]['graphql']['shortcode_media']['display_url']
if 'video_url' in info['entry_data']['PostPage'][0]['graphql']['shortcode_media']:
image_url =info['entry_data']['PostPage'][0]['graphql']['shortcode_media']['video_url']
image_url = image_url.split('?')[0] + '?_nc_ht=instagram.fcph1-1.fna.fbcdn.net'
ext = image_url.split('.')[-1]
size = int(get_head(image_url)['Content-Length'])
try:
image_url = image_url.split('?')[0]
ext = image_url.split('.')[-1]
size = int(get_head(image_url)['Content-Length'])
except:
image_url = image_url.split('?')[0] + '?_nc_ht=instagram.fcph1-1.fna.fbcdn.net'
ext = image_url.split('.')[-1]
size = int(get_head(image_url)['Content-Length'])
print_info(site_info, title, ext, size)
if not info_only:
download_urls(urls=[image_url],
Expand Down

0 comments on commit c90a44c

Please sign in to comment.