Skip to content
This repository has been archived by the owner on Jul 4, 2022. It is now read-only.

Commit

Permalink
Fix plus7
Browse files Browse the repository at this point in the history
  • Loading branch information
solsticedhiver committed Oct 12, 2016
1 parent aa468a3 commit 2d588c4
Showing 1 changed file with 5 additions and 16 deletions.
21 changes: 5 additions & 16 deletions arteVIDEOS.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

DOMAIN = 'http://www.arte.tv'
GUIDE_URL = DOMAIN + '/guide/%s/plus7'
API_URL = DOMAIN + '/papi/tvguide/videos/plus7/program/%s/L2/ALL/ALL/-1/AIRDATE_DESC/0/0/DE_FR.json'
API_URL = DOMAIN + '/guide/%s/plus7/videos?page=1&isLoading=true&limit=50&sort=newest'
PROGRAM_URL = DOMAIN + '/papi/tvguide/videos/plus7/program/%s/L2/ALL/%s/-1/AIRDATE_DESC/%d/%d/DE_FR.json'
LIVE_URL = DOMAIN + '/papi/tvguide/videos/livestream/%s/'
VIDEO_URL = DOMAIN + '/guide/%s/'
Expand Down Expand Up @@ -245,6 +245,7 @@ def request(self, url):
try:
data = urllib2.urlopen(url).read()
data_json = json.loads(data)
print data_json
videos = extract_videos(data_json, self.options)
self.stop = True
self.results.extend(videos)
Expand All @@ -253,7 +254,7 @@ def request(self, url):

def plus7(self):
'''get the list of videos from url'''
url = API_URL % self.options.lang[:1]
url = API_URL % self.options.lang
print ':: Retrieving plus7 videos list'
self.request(url)

Expand Down Expand Up @@ -569,20 +570,8 @@ def get_url(url_page, quality='hd', lang='fr', method='HTTP'):
def extract_videos(data_json, options):
'''extract list of videos title, url, and teaser from data_json'''
videos = []
for v in data_json['program%sList' % options.lang.upper()]:
title = v['VDO']['VTI']
if 'V7T' in v['VDO'].keys():
teaser = v['VDO']['V7T'].strip()
else:
teaser = "No teaser"
vid = v['VDO']['VID']
if 'VDE' not in v['VDO']:
desc = ''
else:
desc = v['VDO']['VDE'].strip()
date = v['VDO']['VRA']
infoprog = v['VDO']['infoProg']
videos.append(Video(vid, title, teaser, options, desc=desc, date=date, infoprog=infoprog))
for v in data_json['videos']:
videos.append(Video(v['id'], v['title'], v['teaser'], options))
return videos

def extract_url_video_json(vid, quality, lang):
Expand Down

0 comments on commit 2d588c4

Please sign in to comment.