Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to fetch the url error when refreshing a watchlist with several pages #739

Closed
2 of 4 tasks
cpassuel opened this issue May 18, 2024 · 15 comments
Closed
2 of 4 tasks
Labels

Comments

@cpassuel
Copy link

Addon used

  • Amazon VOD (plugin.video.amazon-test)
  • Browser Launcher (plugin.program.browser.launcher)
  • Addon version: 1.0.7~beta1

Account type

  • primevideo.com
  • amazon.(com/co.uk/de/jp)

System Setup (please provide the following information):

  • Hardware:Raspberry Pi 4
  • OS version: Libreelec 9.2.8
  • Kodi version number: Kodi 18.9

Upload Logs

Describe the bug

I have an error since few days on watchlist that contains several pages, it seems that the first page is ok but there is an error when trying to get the second page. Below an excerpt of the log (I truncated the url displayed in the error message as I don't know it if contains password or sensitive informations)

2024-05-18 20:46:01.278 T:2430595904 NOTICE: [Amazon VOD] Refresh params: ({u'lazyLoadURL': u'/mystuff/watchlist/movie/ref=atv_hm_hom_c_9zZ8D2_mys_wl?episodeListSize=9999', u'title': u'Films'}, [u'root', u'Watchlist', u'watchlist', u'movie'], True)
2024-05-18 20:46:18.831 T:2430595904 ERROR: [Amazon VOD] Error reason: 400 error (NoRetries)
2024-05-18 20:46:18.832 T:2430595904 ERROR: [Amazon VOD] Unable to fetch the url: /gp/video/api/paginateCollection?startIndex=20&paginationTargetId=V2%3D4AEA6u69gYPeuYe-toZwYWdlSWSIcGFnZVR5cGWMY29sbGVjdGlvbklkiHdpZGdldElkjo5zd2lmdElkVmVyc2lvbt7EiolXYXRjaGxpc3SLhGhvbWWMjqoxOjEyT0xTQUFDUE0xQ083IyNNWlFXR1pMVU1WU0VHWUxTTjUyWEdaTE2ND46CVjI%3D&serviceToken=eyJ0eXBlIjoiaHBhZ2UiLCJuYXYiOmZhbHNlLCJzZWMiO

@cpassuel cpassuel changed the title Unable to fetch the url error when refresh a watchlist with several pages Unable to fetch the url error when refreshing a watchlist with several pages May 18, 2024
@Paco8
Copy link
Contributor

Paco8 commented May 23, 2024

Same problem here.

@Sandmann79 Sandmann79 added the bug label May 23, 2024
@Sandmann79
Copy link
Owner

Can confirm. Work on it when back from vacation.

@cpassuel
Copy link
Author

I did a quick look at the source code of my watchlist on primevideo.com and it seems that startIndex is now called paginationStartIndex in the url

@Paco8
Copy link
Contributor

Paco8 commented May 28, 2024

Adding this line fixes it for me:

--- web_api-orig.py	2024-05-28 14:13:48.329176979 +0200
+++ web_api.py	2024-05-28 14:14:22.586854740 +0200
@@ -1445,6 +1447,7 @@
                             q = ['{}={}'.format(k.replace('paginationServiceToken', 'serviceToken').replace('paginationStartIndex', 'startIndex'), ','.join(v) if isinstance(v, list) else quote_plus(str(v)))
                                  for k, v in vo.items() if k in ['collectionType', 'paginationServiceToken', 'paginationTargetId', 'tags', 'paginationStartIndex']]
                             q.append('pageSize=20&pageType=browse&pageId=default')
+                            q.append('&isCleanSlateActive=1&isDiscoverActive=1&isLivePageActive=1&variant=desktopLinux&actionScheme=default&payloadScheme=default&decorationScheme=web-search-decoration-tournaments-v2&featureScheme=web-search-v4&dynamicFeatures=integration&dynamicFeatures=CLIENT_DECORATION_ENABLE_DAAPI&dynamicFeatures=ENABLE_DRAPER_CONTENT&dynamicFeatures=HorizontalPagination&dynamicFeatures=CleanSlate&dynamicFeatures=EpgContainerPagination&dynamicFeatures=ENABLE_GPCI&dynamicFeatures=SupportsImageTextLinkTextInStandardHero&widgetScheme=web-explorecs-v11&journeyIngressContext=&isRemasterEnabled=0')
                             if 'collectionType' not in q:
                                 q.append('collectionType=Container')
                             nextPage = '/gp/video/api/paginateCollection?' + '&'.join(q)

@cpassuel
Copy link
Author

Adding this line fixes it for me:

Thanks, I works for me too.

@mlc42
Copy link

mlc42 commented May 29, 2024

I add the line after

q.append('pageSize=20&pageType=browse&pageId=default')

q.append('&isCleanSlateActive=1&isDiscoverActive=1&isLivePageActive=1&variant=desktopLinux&actionScheme=default&payloadScheme=default&decorationScheme=web-search-decoration-tournaments-v2&featureScheme=web-search-v4&dynamicFeatures=integration&dynamicFeatures=CLIENT_DECORATION_ENABLE_DAAPI&dynamicFeatures=ENABLE_DRAPER_CONTENT&dynamicFeatures=HorizontalPagination&dynamicFeatures=CleanSlate&dynamicFeatures=EpgContainerPagination&dynamicFeatures=ENABLE_GPCI&dynamicFeatures=SupportsImageTextLinkTextInStandardHero&widgetScheme=web-explorecs-v11&journeyIngressContext=&isRemasterEnabled=0')

but same error

2024-05-29 20:00:24.927 T:1364 info : [Amazon VOD] Refresh params: ({'title': 'Serien', 'lazyLoadURL': '/gp/video/mystuff/watchlist/tv/ref=atv_hm_hom_c_9zZ8D2_mys_wl?episodeListSize=9999', 'pos': 5}, ['root', 'Watchlist', 'watchlist', 'tv'], False)
2024-05-29 20:00:47.122 T:1364 error : [Amazon VOD] Error reason: 400 error (NoRetries)
2024-05-29 20:00:47.124 T:1364 error : [Amazon VOD] Unable to fetch the url: /gp/video/api/paginateCollection?serviceToken=eyJ0eXBlIjoiaHBhZ2UiLCJuYXYiOmZhbHNlLCJzZWMiOiJjZW50ZXIiLCJwcmlkIjoiOTE5ZDc5MjctODMxNy00OTg4LTkyMzQtYTI2YzhlMGVhMGE2IiwiZmlsdGVyIjp7IlRWIjpbXX0sIm9mZnNldCI6MCwibnBzaSI6MjAsIm9yZXEiOiJlZjAwN2QyMi01YzBjLTQwNDktYWUxYy01ZDU2YjVlOTQwODQ6MTcxNzAwNTYyNTAwMCIsImFwTWF4Ijo5Nywic3RyaWQiOiIxOjExQU5XTkpQVDdaUEJSIyNNWlFXR1pMVU1WU0VHWUxTTjUyWEdaTE0iLCJvcmVxayI6IlAvNStDbmFlbzIyL3JLdjNyQlFJRjlNdmFNdG0ydDNHSWJQMmFUWmQwMXM9Iiwib3JlcWt2IjoxfQ%3D%3D&startIndex=20&paginationTargetId=V2%3D4AEA6u69gYPeuYe-toZwYWdlSWSIcGFnZVR5cGWMY29sbGVjdGlvbklkiHdpZGdldElkjo5zd2lmdElkVmVyc2lvbt7EiolXYXRjaGxpc3SLhGhvbWWMjqoxOjExQU5XTkpQVDdaUEJSIyNNWlFXR1pMVU1WU0VHWUxTTjUyWEdaTE2ND46CVjI%3D&pageSize=20&pageType=browse&pageId=default&collectionType=Container
2024-05-29 20:00:54.423 T:1364 info : [Amazon VOD] Version: 1.0.6+matrix.1

@cpassuel
Copy link
Author

cpassuel commented May 29, 2024

@mlc42 From the log, you don't have the latest version: the latest is 1.0.7~beta1.
Update first to the latest version and then add the line

@mlc42
Copy link

mlc42 commented May 30, 2024

@cpassuel thank you, but i can´t find a python 3 version 1.0.7 for matrix.

@cpassuel
Copy link
Author

cpassuel commented May 30, 2024

@mlc42 I don't know if it's the same for the matrix version, but I updated manually my leia version from the git repo as the plugin was not updated automatally.

If you're on Libreelec on Pi and you know a bit of linux, here is a script (beware not fully tested but gives you the steps) to update directly from the master branch on git repo

# Remove compiled files to reduce archive size
find /storage/.kodi/addons/plugin.video.amazon-test/ -type f -name '*.pyo' -delete
# Archive existing version
#TODO change destination folder
# zip -r /tmp/avod_$(date +"%Y%m%d%H%M%S").zip /storage/.kodi/addons/plugin.video.amazon-test/*
# Download code from xbmc repo
curl https://codeload.github.com/Sandmann79/xbmc/zip/refs/heads/master --output /tmp/avod.zip
# Unzip Amazon VOD
unzip /tmp/avod.zip xbmc-master/plugin.video.amazon-test/* -d /tmp
# Copy to addons folder
cp -r /tmp/xbmc-master/* /storage/.kodi/addons/
# Clean up - delete archive and extract folder
rm /tmp/avod.zip
rm -r /tmp/xbmc-master/*

@mlc42
Copy link

mlc42 commented Jun 2, 2024

@cpassuel

thank you, but this version uses python 2. So i´ve to wait for a new version

@Sandmann79
Copy link
Owner

It is not necessary to update to beta 1, as there is currently no difference between stable and beta in the code.

Sandmann79 added a commit that referenced this issue Jun 3, 2024
thx @cpassuel

Signed-off-by: Sandmann79 <sandmann79@gmx.net>
@mlc42
Copy link

mlc42 commented Jun 4, 2024

now the fix works in matrix
thank you all

@yrp888
Copy link

yrp888 commented Jun 5, 2024

Sorry for sounding a bit stupid but how do I apply the fix?

@mlc42
Copy link

mlc42 commented Jun 5, 2024

@yrp888

I´ve changed source in addon folder storage/.kodi/addons/plugin-amazon-test/resoures/lib/web_api.py.
I use WinSCP to edit.

Lines 1444-1452 now lokks like this

                    elif 'paginationTargetId' in vo:
                        q = ['{}={}'.format(k.replace('paginationServiceToken', 'serviceToken').replace('paginationStartIndex', 'startIndex'), ','.join(v) if isinstance(v, list) else quote_plus(str(v)))
                             for k, v in vo.items() if k in ['collectionType', 'paginationServiceToken', 'paginationTargetId', 'tags', 'paginationStartIndex']]
                        q.append('pageSize=20&pageType=browse&pageId=default&variant=desktopWindows&actionScheme=default&payloadScheme=default \
                                  &decorationScheme=web-search-decoration-tournaments-v2&featureScheme=web-search-v4&dynamicFeatures=HorizontalPagination&widgetScheme=web-explorecs-v11')
                        if 'collectionType' not in q:
                            q.append('collectionType=Container')
                        nextPage = '/gp/video/api/paginateCollection?' + '&'.join(q)

@yrp888
Copy link

yrp888 commented Jun 5, 2024

Thanks for your prompt response @mlc42 - it looks like 1.07 has been released so I'll try updating to that first.

Update - installed 1.07 on two NUCs and problem solved. Thanks to @Sandmann79 as always for your efforts!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants