meriko / RoosterTeeth.bundle

4 stars 9 forks source link

Sponsor support #3

Closed brinsche closed 8 years ago

brinsche commented 8 years ago

Would it be possible to add support for sponsor accounts?

Also, it may be nice to add support for achievementhunter, funhaus etc but those would probably have to be separate plugins.

meriko commented 8 years ago

@Memorion Please try out the new version in the login_support branch: https://github.com/meriko/RoosterTeeth.bundle/archive/login_support.zip

  1. Download(use link above)
  2. Unzip
  3. Make sure the resulting directory ends with .bundle, e.g. you could rename it to something like RoosterTeeth_Beta.bundle
  4. Restart Plex Media Server
  5. Use Plex/Web to set username and password + check the "Enable login"
  6. Restart the plugin

Note! Since I don't have a login this is untested

brinsche commented 8 years ago

Thanks! Logging in seems to work and it shows the sponsor only videos, but when I try to play one of those I just get "This channel is not responding."

meriko commented 8 years ago

I think I know what the problem is(related to the URL service). Could you please upload some logs?

  1. Restart Plex Media Server(to clean up old logs)
  2. Attempt a playback of a sponsor video
  3. Upload the following logs: "com.plexapp.plugins.roosterteeth.log", "com.plexapp.system.log". How to find the logs: https://support.plex.tv/hc/en-us/articles/201106148-Channel-Log-Files

Also, I added the additional channels(Achievement Hunter etc) in this branch: https://github.com/meriko/RoosterTeeth.bundle/archive/extras.zip

brinsche commented 8 years ago

Here's the system log https://gist.github.com/Memorion/92fff2b39be44717bf0deb4c83db913e , the plugin didn't seem to actually log something after the restart and in an older plugin log I could see my password in an url

brinsche commented 8 years ago

The version for AchievmentHunter etc doesn't seem to work, it still shows up as one channel with only Roosterteeth content

brinsche commented 8 years ago

Sorry for not noticing this earlier, the login seems to fail: 2016-04-24 15:04:52,378 (700002a3b000) : INFO (__init__:218) - Attempting to login 2016-04-24 15:04:52,379 (700002a3b000) : DEBUG (networking:166) - Requesting 'http://roosterteeth.com/login' 2016-04-24 15:04:53,375 (700002a3b000) : DEBUG (networking:166) - Requesting 'http://roosterteeth.com/login' 2016-04-24 15:04:54,015 (700002a3b000) : INFO (__init__:240) - Login failed! 2016-04-24 15:04:54,016 (700002a3b000) : DEBUG (runtime:88) - Sending packed state data (1453 bytes) 2016-04-24 15:04:54,016 (700002a3b000) : DEBUG (runtime:924) - Response: [200] MediaContainer, 431 bytes

meriko commented 8 years ago

Thanks for the logs!

Please try the following:

  1. Delete all bundles for rooster teeth in the plugin directory of PMS
  2. Download https://github.com/meriko/RoosterTeeth.bundle/archive/wip.zip
  3. Unzip
  4. Rename to RoosterTeeth.bundle
  5. Place in PMS plugin directory
  6. Restart PMS
    • I think the problem with Achievement Hunter etc is because there are multiple channels with the same identifier.
    • I have updated the login to be less strict, i.e. removed the requirement for the username to be in the response for the login call
    • Also updated so that additional logins are performed when trying to find the video url

It's strange that you could see your password in an url since the method used is HTTP POST? Did you see it in the com.plexapp.plugins.roosterteeth.log file?

brinsche commented 8 years ago

Now it complains that it can't find LOGIN_URL:

2016-04-24 15:23:48,419 (7000029b8000) :  CRITICAL (sandbox:303) - Exception when calling function 'MetadataObjectForURL' (most recent call last):
  File "/Applications/Plex Media Server.app/Contents/Resources/Plug-ins-ee6e505/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py", line 294, in call_named_function
    result = f(*args, **kwargs)
  File "/Users/memorion/Library/Application Support/Plex Media Server/Plug-ins/RoosterTeeth.bundle/Contents/Services/URL/Rooster Teeth/ServiceCode.pys", line 12, in MetadataObjectForURL
    cookies = Login()
  File "/Users/memorion/Library/Application Support/Plex Media Server/Plug-ins/RoosterTeeth.bundle/Contents/Services/Shared Code/roosterteeth.pys", line 6, in Login
    element = HTML.ElementFromURL(LOGIN_URL)
NameError: global name 'LOGIN_URL' is not defined

2016-04-24 15:23:48,419 (7000029b8000) :  CRITICAL (services:745) - Exception calling function in URL service "Rooster Teeth" (com.plexapp.plugins.roosterteeth)
2016-04-24 15:23:48,420 (7000029b8000) :  CRITICAL (runtime:889) - Exception (most recent call last):
  File "/Applications/Plex Media Server.app/Contents/Resources/Plug-ins-ee6e505/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/runtime.py", line 843, in handle_request
    result = f(**d)
  File "/Applications/Plex Media Server.app/Contents/Resources/Plug-ins-ee6e505/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/handlers/services.py", line 26, in url_lookup
    c = self._core.services.metadata_object_for_url(url, in_container=True)
  File "/Applications/Plex Media Server.app/Contents/Resources/Plug-ins-ee6e505/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/services.py", line 725, in metadata_object_for_url
    return self._get_result_from_function_for_url(self.metadata_object_for_url_from_service, url, do_normalization, dict(add_items_automatically = add_items_automatically, allow_deferred = allow_deferred, in_container = in_container))
  File "/Applications/Plex Media Server.app/Contents/Resources/Plug-ins-ee6e505/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/services.py", line 741, in _get_result_from_function_for_url
    result = func(url, service, **kwargs)
  File "/Applications/Plex Media Server.app/Contents/Resources/Plug-ins-ee6e505/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/services.py", line 642, in metadata_object_for_url_from_service
    metadata = self._call_named_function_in_service(METADATA_OBJECT_FUNCTION_NAME, service, [url])
  File "/Applications/Plex Media Server.app/Contents/Resources/Plug-ins-ee6e505/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/services.py", line 589, in _call_named_function_in_service
    return self._call_named_function_in_sandbox(service.sandbox, fname, None, f_args, f_kwargs, allow_deferred, raise_exceptions, f_optional)
  File "/Applications/Plex Media Server.app/Contents/Resources/Plug-ins-ee6e505/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/components/services.py", line 573, in _call_named_function_in_sandbox
    result = sandbox.call_named_function(fname, allow_deferred=allow_deferred, raise_exceptions=raise_exceptions, args=f_args, kwargs=f_kwargs, mod_name=mod_name, optional_kwargs=f_optional)
  File "/Applications/Plex Media Server.app/Contents/Resources/Plug-ins-ee6e505/Framework.bundle/Contents/Resources/Versions/2/Python/Framework/code/sandbox.py", line 294, in call_named_function
    result = f(*args, **kwargs)
  File "/Users/memorion/Library/Application Support/Plex Media Server/Plug-ins/RoosterTeeth.bundle/Contents/Services/URL/Rooster Teeth/ServiceCode.pys", line 12, in MetadataObjectForURL
    cookies = Login()
  File "/Users/memorion/Library/Application Support/Plex Media Server/Plug-ins/RoosterTeeth.bundle/Contents/Services/Shared Code/roosterteeth.pys", line 6, in Login
    element = HTML.ElementFromURL(LOGIN_URL)
NameError: global name 'LOGIN_URL' is not defined
meriko commented 8 years ago

I'll put up a new version shortly

brinsche commented 8 years ago

Thanks for all the work! I tried to look at the response when logging in with chrome but chrome can't display the response data either

meriko commented 8 years ago

New version now available

brinsche commented 8 years ago

Still no luck, new logs here: https://gist.github.com/Memorion/3d2af97563024138f8b03c57f368e406

brinsche commented 8 years ago

this is the login request from chrome copied as curl request, I replaced my username and pw, no idea if this is helpful or if there's still sensitive information in it

curl 'https://roosterteeth.com/login' -H 'origin: https://roosterteeth.com' -H 'accept-encoding: gzip, deflate' -H 'accept-language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4' -H 'cookie: __cfduid=d9b4027ce7c98b7d838a9349541775aa81430948366; rt_user=Q2FCbHJNeVY0K1NuNDB0SnpNQVlHaTVIOXllOHg0K2Y0enhHVWNCeDZPY2N4M1g0ZElpOUljNmhzOWJCUEhrODVBcTZGNEFLdlBHZ1dJalpJTURjNkpNUElrR3BDRVpXbjBjM0hZRW1RZVFvK1ZOSEN6WTg%3D; rt_remember=bk10aWI4M3E3UE5ab1d2WVRWU1B3UT09; rtusername=USERNAME; rtspons=MQ%3D%3D; showedSocialTip/archive/=1; showedSocialTip/home.php=1; eyeNum=0; rtlastid=R1ovTUJLQjJlcmxEUDVxNDZQaE8%3D; AWSELB=D3C577BF0CFB0CD5886D5241D4817D9B43E9E7BB1B9A9069FD8E15CBA252A1AB62EDA264A297009EBEDC34FCE8243A2BD0CC78869E8486584DB6EB9198A4A23FDE11443BC3395214AC3586AF28C6CA684585B5B0EF; cf_clearance=e04398171b0cafc872090a848f5a0cf695c6dd3c-1459355692-2592000; umbel_browser_id=9bf06e2d-7ff7-45fe-a225-23befe39929a; ajs_user_id=null; ajs_group_id=null; ajs_anonymous_id=%2256ed079e-d697-4f85-a0f8-7f8a893df44f%22; _ga=GA1.2.1451828260.1436292084; laravel_session=eyJpdiI6ImRKZVJqYW9mb3ZmTVhvSFZkTjZtWElOZW1pWGlBZWY3TzIrZDBNWjdOQmc9IiwidmFsdWUiOiI4ZUczSFp1N3B2NnJvbnhieTZ6eThvS2JNRzlyT1Y5dDJsa3hrTmFTampuUXYxckRiV1lod2FVNWplcjNMcDFOSE5GSzRWNEZjQkZWTDR3VU02QmMzUT09IiwibWFjIjoiZGMwNDYyMWQwYzk5YzFkODAwMzI4NzNmNzc3YzJjODAyNWI5MDIzMjgxZmI2ZTg0MzIyZWUwOTdiZDQ4ZDYxMyJ9' -H 'upgrade-insecure-requests: 1' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36' -H 'content-type: application/x-www-form-urlencoded' -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'cache-control: max-age=0' -H 'authority: roosterteeth.com' -H 'referer: https://roosterteeth.com/login' -H 'dnt: 1' --data '_token=QdcsYmA36MedUAV1zhihsr1TOkwVP3YecFm2Y6w9&username=USERNAME&password=PASSWORD&redirectTo=http%3A%2F%2Froosterteeth.com%2F' --compressed
meriko commented 8 years ago

Ok thanks for the logs and the curl example.

I'll have a look at it!

brinsche commented 8 years ago

You could create an account yourself, that way you wouldn't need to wait for my feedback. logging in could probably be tested without the sponsorship and even that has a 30 free trial! 😄

meriko commented 8 years ago

New version available.

Thanks, maybe I'll have a look at the trial offer(as long as they don't need my credit card number etc :))

brinsche commented 8 years ago

No luck :/ https://gist.github.com/Memorion/f00755962f5bdb621f1b6532a2f28aa6

meriko commented 8 years ago

I removed the headers in the post call, please try new version

brinsche commented 8 years ago

Same error https://gist.github.com/Memorion/46b2d1b7a4f5e65b3b309c1d66202212 If I look at the login request in the chrome dev tools it shows this cookie https://www.dropbox.com/s/njryurwwaxs8dad/Screenshot%202016-04-24%2016.13.09.png?dl=0 but if I click on the response tab it just shows "Failed to load response data" could that be the problem?

meriko commented 8 years ago

Yes that's probably it. No content is returned, instead only the headers

-> New version available

meriko commented 8 years ago

Nah, wait. I found another bug :-)

meriko commented 8 years ago

Now it should be fixed

brinsche commented 8 years ago

It shows the other channels now but videos still don't work :/ https://gist.github.com/Memorion/cdda3d282e7eb79b791949af8a5b598d in the latest versions no videos play, not just the sponsor ones

meriko commented 8 years ago

New update available, last try for today.

It might be best if you completely removed your current plugin(as described in previous post) + restart PMS afterwards.

meriko commented 8 years ago

Also, which client are you using?

If it's Plex/Web the cache function in the browser often messes things up. If you have PHT it's much better in this dev phase

brinsche commented 8 years ago

No luck :/ https://gist.github.com/Memorion/7560242894119f68d70778e5b51b0962 I removed the bundle and restarted plex every time, I did use the web player but I just tried it with the new plex-media-player and the android client and had no luck in either

meriko commented 8 years ago

@Memorion New version(in the wip branch as before) Now some cookies are returned, but don't know if that'll change anything ...

kyse commented 8 years ago

You guys get this working? Be nice to get it added to master so UAS can pull it.

dyuser commented 8 years ago

Didn't know if there was an update to this issue.

meriko commented 8 years ago

Since I don't use this channel very much + they require your credit card to create an account I haven't been able to test this update.

If someone with an existing account wants to try the new version download it here: https://github.com/meriko/RoosterTeeth.bundle/archive/wip.zip

dyuser commented 8 years ago

I would be willing to test and help with adding this feature. I downloaded the bundle and it seems as though any content from the rooster teeth section (sponsored and normal) works fine; however, any content from any other section IE achievement hunter, funhaus, etc. Does not show with a no content found message. If you wouldn't mind looking at the code if I help test I would be happy to provide more info or additional logs. Also it seems as though the plugin also saved my login credentials in the log. For review i altered the log to read someuser as a username and somepassword as a password. Those are the only change I made. logs.zip

Edited for grammer

kyse commented 8 years ago

Confirmed, Rooster Teeth section allows me to stream locked content. The rest give Channel not responding when I try to click on shows feeds.

dyuser commented 8 years ago

Okay so it seems that there were url format issues in the Contents/Services/ServiceInfo.plist file. All subsidiary channels of Roosterteeth have the domain name of $subset.roosterteeth.com. IE:

http://achievementhunter.com/episode/.+

should actually read:

http://achievementhunter.roosterteeth.com/episode/.+

Once changed the other groups seem to work. I don't know if @meriko would like to update the file to reflect those changes and add new groups like cow chop or if you would like me to and upload the file to this thread or request a commit. Please let me know. Also if anyone else sees this if you could change your local copy to reflect this and test to make sure I'm not crazy.

kyse commented 8 years ago

I tried that change and still get channel not responding. Donno if that's some other paywall my account doesn't have access to or not, but at least the main videos work now.

meriko commented 8 years ago

Just pushed an update to fix the regex problem in ServiceInfo.plist, thanks for the info @dyuser

Please try this new version and if it's working ok I'll merge it to the master branch(so that UAS can auto-update)

Note! You need to restart Plex Media Server in order for this update to become active

dyuser commented 8 years ago

@meriko Tested the new wip. It seems like the regex that you provided removed all but rt content instead of adding the other groups. Looking at the expression the logic seems to make sense but I don't know how the channel knows about achievement hunter etc without specifying them specifically in the file.

dyuser commented 8 years ago

@meriko when i look at what has changed in the recent update (https://github.com/meriko/RoosterTeeth.bundle/compare/wip) it seems as though the domains are incorrect ie achievementhunter.com instead of achievementhunter.roosterteeth.com. I'm just trying to understand why the groups are now not showing.

dyuser commented 8 years ago

@meriko Sorry for the multiple messages. Removed your base url line in Contents/Code/init.py and we're back to working with the multiple channels after I update the urls ie achievementhunter.roosterteeth.com

dyuser commented 8 years ago

After fixing the urls I also added a link to CowChop since they are now part of RoosterTeeth. I realize that there isn't a hyperlink on the homepage for roosterteeth but the site and logo are active with content. These changes fixed all the issues that I had with the channel and everything seems to be working properly now. I am a first member so I'm not sure if this is working for everyone hopefully @kyse can test to see if their issues are resolved.

{ 'title': 'CowChop', 'url': 'http://cowchop.roosterteeth.com/show', 'image': 'http://cowchop.roosterteeth.com/images/logo-cc.png' },

kyse commented 8 years ago

I have a first account as well. Will test in a few hours though.

kyse commented 8 years ago

Latest WIP seems to work ok for me.

meriko commented 8 years ago

Thanks!

I'll merge these changes into master then :)

meriko commented 8 years ago

Done!

If any problems are detected, please feel free to open a new issue