Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
[Pandora.tv] Extractor giving error "ValueError: time data '/x/y/xyz' does not match format '%Y%m%d'" #12846
Comments
|
Something like this should work: --- a/youtube_dl/extractor/pandoratv.py 2017-05-09 13:09:52.000000000 -0500
+++ b/youtube_dl/extractor/pandoratv.py 2017-05-09 13:11:09.000000000 -0500
@@ -1,5 +1,6 @@
# coding: utf-8
from __future__ import unicode_literals
+import re
from .common import InfoExtractor
from ..compat import (
@@ -80,13 +81,21 @@
})
self._sort_formats(formats)
+ fid = info.get('fid')
+ upload_date = None
+ if fid is not None:
+ matches = re.findall(r'(\d+)', fid)
+ if matches is not None:
+ upload_date = max(matches, key=len)
+ upload_date = upload_date[:8]
+
return {
'id': video_id,
'title': info['subject'],
'description': info.get('body'),
'thumbnail': info.get('thumbnail') or info.get('poster'),
'duration': float_or_none(info.get('runtime'), 1000) or parse_duration(info.get('time')),
- 'upload_date': info['fid'][:8] if isinstance(info.get('fid'), compat_str) else None,
+ 'upload_date': upload_date,
'uploader': info.get('nickname'),
'uploader_id': info.get('upload_userid'),
'view_count': str_to_int(info.get('hit')),I can create a PR if collaborators agree it looks fine. |
|
In the "not working" example (/k/e/keigoo/30/20170423175419187mshwpggef3c83), the date is still available in the last part (20170423175419187mshwpggef3c83), which should be extracted. |
|
By the way, http://channel.pandora.tv/channel/video.ptv?ch_userid=gogoucc&prgid=54721744 is working now:
Any other example? If none I guess this can be closed. |
|
@yan12125 If you only use "-F" to check available formats then its working (I guess because it does not involve parsing upload_date), but if you really perform a download then its still giving the same error. |
|
You're got it! @isaacm Are you still working on this? |
|
No, I only investigated the problem to figure out the root cause of the error. You can take up the work based on my findings and code snippet above. Or close the ticket if it's resolved. |
|
Fixed in cc2ffe5 :) |
Please follow the guide below
xinto all the boxes [ ] relevant to your issue (like that [x])Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2017.04.26. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.Before submitting an issue make sure you have:
What is the purpose of your issue?
The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue
If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:
Add
-vflag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):Description of your issue, suggested solution and other information
The extractor for pandora.tv recently started not working for some videos. Checking pandoratv.py I can see it is using the URL "http://m.pandora.tv/?c=view&m=viewJsonApi&ch_userid=%s&prgid=%s" to download metadata for the video in JSON format.
After downloading the JSON data, it will extract the video upload date from the field ['data']['rows']['vod_play_info']['result']['fid'], expecting first 8 characters of the field to be in "YYYYMMDD" format. However recently pandora.tv appear to have changed format of this field for some videos.
Working: http://m.pandora.tv/?c=view&m=viewJsonApi&ch_userid=gogoucc&prgid=54730858
fid: 201704262212063498v3c5ric2jmvu
Not working: http://m.pandora.tv/?c=view&m=viewJsonApi&ch_userid=gogoucc&prgid=54721744
fid: /k/e/keigoo/30/20170423175419187mshwpggef3c83
I believe the extractor code need to be modified to work with both formats.