einstein95 / crunchy-xml-decoder

GNU General Public License v2.0
35 stars 14 forks source link

player_revision information changed #46

Closed deforation closed 8 years ago

deforation commented 8 years ago

The Information where the player_revision on the crunchyroll page lies, seems to have changed.

swfobject.embedSWF("XXXXX",'showmedia_video_player','960', '570', '9.0.115','XXX',{"config_url":"XXX"},{"wmode":"transparent","allowFullScreen":"true","allowscriptaccess":"always","allownetworking":"all"},{"id":"showmedia_video_player","style":"display:block;"},loadBrandedPlayerAd);

The Information for the player_revision is now the fifth parameter:

 '9.0.115'

The Issue can be fixed, by replacing the current function def playerrev(url) in altfuncs.py with the following implementation:

def playerrev(url):
    global player_revision 

    revision_regex = r"swfobject.embedSWF\(\"(.+)'(?P<revision>([0-9]\.)+[0-9]+)'(.+)\)"
    try:
        player_revision = re.search(revision_regex, gethtml(url)).group("revision")
    except IndexError:
        try:
            url += '?skip_wall=1'  # perv
            html = gethtml(url)
            player_revision = re.search(revision_regex, html).group("revision")
        except IndexError:
            open('debug.html', 'w').write(html.encode('utf-8'))
            sys.exit('Sorry, but it looks like something went wrong with accessing the Crunchyroll page. Please make an issue on GitHub and attach debug.html which should be in the folder.')
    return player_revision

Afterwards, the download of videos was possible again.

deforation commented 8 years ago

Problem fixed in Master.