popcorn-time-ru / popcorn-ru

Multilang api for popcorn
https://www.reddit.com/r/PopCornTimeApp/
148 stars 61 forks source link

Error when getting Movies & Shows on custom deployment #45

Closed ottar-eten-yod closed 2 years ago

ottar-eten-yod commented 2 years ago

I get given a Error 500 when I use my own deployment of the API using the Popcorn Time API.

E.g. https://<domain>/movies/1?sort=trending&limit=50&locale=en&contentLocale=en&showAll=1&genre=All&order=-1 https://<domain>/shows/1?sort=trending&limit=50&locale=en&contentLocale=en&showAll=1&genre=All&order=-1

Returns [1:68] [field_sort] unknown field [nested_path] did you mean [nested]?

harisnaeemofficial commented 2 years ago

I also tried to deploy on my server and got the same error

[1:183] [field_sort] unknown field [nested_path] did you mean [nested]?

Any solution for this?

and When trying to access single movie data it says {"message":"Not Found","code":404}

harisnaeemofficial commented 2 years ago

file getting error is /src/Service/Search

private function buildSort(string $sort, string $order) { switch ($sort) { case 'title': case 'name': return [ 'title' => $order, 'locales.title' => $order ]; case 'popularity': return [ 'rating.popularity' => [ 'nested_path' => 'rating', 'order' => $order], 'rating.watchers' => [ 'nested_path' => 'rating', 'order' => $order], ]; case 'rating': return [ 'rating.weightRating' => [ 'nested_path' => 'rating', 'order' => $order], ]; case 'released': case 'updated': return [ 'released' => $order ]; case 'last added': return [ 'created' => $order ]; case 'trending': return [ 'rating.watching' => [ 'nested_path' => 'rating', 'order' => $order], 'rating.watchers' => [ 'nested_path' => 'rating', 'order' => $order], ]; case 'year': return [ 'year' => $order ]; } return [ 'rating.popularity' => [ 'nested_path' => 'rating', 'order' => 'desc'], 'rating.watchers' => [ 'nested_path' => 'rating', 'order' => 'desc'], ]; }

popcorn-api

harisnaeemofficial commented 2 years ago

@ottar-eten-yod Thanks for your quick response and solution Your update fixed that nested_path issue but Now returns "no such index [movies] [index: movies]"

screencapture-movies-api-ml-movies-1-2022-09-27-11_43_34

ottar-eten-yod commented 2 years ago

@harisnaeemofficial Yeah, I encountered this then remembered you will need to run the following command in the web direcotry via CLI. bin/console spider:run --all

E.g.

cd /var/www/popcorntime
bin/console spider:run --all

I will update the documentation to run this command on deployment.

EDIT 1 - I have updated the documentation on my PR to run this initialisation command.

harisnaeemofficial commented 2 years ago

@ottar-eten-yod Yes I Already started many times but still, no index found Here is the output of bin/console spider:run --all

Screenshot 2022-09-27 145303

ottar-eten-yod commented 2 years ago

Hello @harisnaeemofficial,

It is possible TOR is not working as expected, I have noticed a possible connection issue with it. Can you please run these commands and see what the debug log is? (The last command is the debug log)

cd /var/www/popcorntime
bin/console spider:run --all
bin/console enqueue:consume -vvv --logger=stdout
harisnaeemofficial commented 2 years ago

Hello @ottar-eten-yod, Now everything is fine and working. but the process of spider is very slow. can you tell me that how to change the spider limit from last 48 hours to unlimited? I saw previous comments that they put limit of spider to scrape data from last 48 hours updated movies/tv series

ivan1986 commented 2 years ago

@harisnaeemofficial https://github.com/popcorn-time-ru/popcorn-ru/blob/master/deploy/roles/project/templates/crontab.j2 run one time spider:run --all

harisnaeemofficial commented 2 years ago

When I run sometimes I get the error given below but I don't know why and where is the problem, some episodes and tv shows scrap successfully but some gives error. I want to make it public API if it runs without error and I want to create a big database with it Because I'm a big fan of popcorn projects and their API.

17:04:04 ERROR [app] Client error: GET http://api.trakt.tv/shows/tt7817340/seasons/5/episodes/2 resulted in a 403 Forbidden response 17:04:07 ERROR [app] Client error: GET http://api.trakt.tv/shows/tt9742936/seasons/4/episodes/2 resulted in a 403 Forbidden response 17:04:10 ERROR [app] Client error: GET http://api.trakt.tv/shows/tt11188682/seasons/2/episodes/2 resulted in a 403 Forbidden response

17:02:29 ERROR [app] cURL error 28: Connection timed out after 30000 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://galaxy3yrfbwlwo72q3v2wlyjinqr2vejgpkxb22ll5pcpuaxlnqjiid.onion/torrent/15035271/Proiettile-Vagante-2020-WebDL-1080p-E-AC3-AC3-ITA-FRE-SUBS

17:10:24 WARNING [app] Not found media ["imdb" => "tt22042292","extra" => ["imdb" => "tt22042292"]] 17:14:09 WARNING [app] Not found media ["imdb" => "tt21317760","extra" => ["imdb" => "tt21317760"]]

16:34:25 WARNING [app] Not found media ["imdb" => "tt14893284","extra" => ["imdb" => "tt14893284"]] 16:37:56 WARNING [app] Not found media ["imdb" => "tt20859904","extra" => ["imdb" => "tt20859904"]] 16:41:34 WARNING [app] Not Magnet torrent ["spider" => "Rutracker","topicId" => "6262998","extra" => ["spider" => "Rutracker","topicId" => "6262998"]] 16:41:57 WARNING [app] Not found media ["imdb" => "tt7087260","extra" => ["imdb" => "tt7087260"]] 16:41:57 WARNING [app] Not Magnet torrent ["spider" => "Rutracker","topicId" => "6259427","extra" => ["spider" => "Rutracker","topicId" => "6259427"]] 16:42:41 WARNING [app] Not found media ["imdb" => "tt1194638","extra" => ["imdb" => "tt1194638"]]

harisnaeemofficial commented 2 years ago

Hi @ivan1986 I already run this and got this output https://user-images.githubusercontent.com/24369463/192518540-c4ea2fdd-66ed-43e2-8fea-cd52ac5ac073.png

ivan1986 commented 2 years ago

and it's all, just run queue processor and wait

ottar-eten-yod commented 2 years ago

@ivan1986 Can you please confirm if this is something you want ran on the Linux Cron Job? https://github.com/popcorn-time-ru/popcorn-ru/blob/master/deploy/roles/project/templates/crontab.j2

If so, I will add it to my Pull Request for the install guides.

harisnaeemofficial commented 2 years ago

I don't have any cronjob running in my system I checked using crontab -L. Do we need to add the cron job manually or it will run automatically with the script?

If we need to add manually then please tell me which file we need to run in cronjob. so it will run automatically every day

ottar-eten-yod commented 2 years ago

@harisnaeemofficial I am editing the Documentation now, please give me a few minutes. :)

harisnaeemofficial commented 2 years ago

@ivan1986 Can you please confirm if this is something you want ran on the Linux Cron Job? https://github.com/popcorn-time-ru/popcorn-ru/blob/master/deploy/roles/project/templates/crontab.j2

If so, I will add it to my Pull Request for the install guides.

Yes it's good to mention cronjob guidelines in the installation file :)

ivan1986 commented 2 years ago

@harisnaeemofficial cronjobs correct in template and two of them is commented - all works

0 23 * cd /home/ubuntu/popcorn && bin/console cache:clear

9 cd /home/ubuntu/popcorn && killall -9 php

harisnaeemofficial commented 2 years ago

@ivan1986 I don't understand. I didn't see any line commented in this file https://github.com/popcorn-time-ru/popcorn-ru/blob/master/deploy/roles/project/templates/crontab.j2

0 0 1 /3 cd {{ path }} && bin/console spider:run --all 0 0 * cd {{ path }} && bin/console spider:run --all --last=48

0 8 1 cd {{ path }} && bin/console update:stat 0 3,11,19 * cd {{ path }} && bin/console update:trending

0 1 cd {{ path }} && bin/console update:syncOld 500 --days-check=180 --days-delete=360 0 23 cd {{ path }} && bin/console cache:clear

9 cd /srv/popcorn && killall -9 php 10 cd {{ path }} && pgrep -c -f enqueue:consume || bin/console enqueue:consume --time-limit="now + 55 minutes" --no-debug --memory-limit=200

ottar-eten-yod commented 2 years ago

@harisnaeemofficial @ivan1986 I have updated my PR to include the CronJob steps.

ivan1986 commented 2 years ago

@harisnaeemofficial it's commented on server

ottar-eten-yod commented 2 years ago

@harisnaeemofficial I made a small adjustment in my latest push, please check the change. https://github.com/popcorn-time-ru/popcorn-ru/pull/47/commits/978837609a7f11cf9e5a0ba2beb2317e8b22fc41

harisnaeemofficial commented 2 years ago

@harisnaeemofficial it's commented on server this file is on my live server should I comment something in this also? Screenshot 2022-10-01 215148

ottar-eten-yod commented 2 years ago

That can be left how it is, no need to edit that since Linux will not use it.

ivan1986 commented 2 years ago

{{ path }} it's ansible template var - replace to real path, where you setup app

a, ok, and show you crontab -l

ottar-eten-yod commented 2 years ago

@ivan1986 The issues with Trakt still persist however. Possibly the API calls need updating?

[root@testvps popcorntime]# /var/www/popcorntime/bin/console update:trending

In RequestException.php line 113:

  Client error: `GET http://api.trakt.tv/movies/trending?limit=1000` resulted in a `403 Forbidden` response  

update:trending
ivan1986 commented 2 years ago

@ottar-eten-yod TRAKT_KEY correct? code works fine

ottar-eten-yod commented 2 years ago

I have found the issue, pushing a fix to the Documentation now... @harisnaeemofficial

ottar-eten-yod commented 2 years ago

It turns out you need to provide the Client ID not Client Secret.

harisnaeemofficial commented 2 years ago

{{ path }} it's ansible template var - replace to real path, where you setup app

a, ok, and show you crontab -l

My crontab file is empty. what should I insert in the crontab file?

ivan1986 commented 2 years ago

@harisnaeemofficial yes copy from template and replace path

ottar-eten-yod commented 2 years ago

@harisnaeemofficial You should run the commands found here - https://github.com/ottar-eten-yod/popcorn-ru/blob/patch-1/Documentation/Debian-10-11.md#initialise-popcorn-time-database

(Commands at the bottom of the page)

ivan1986 commented 2 years ago

@ottar-eten-yod it's not init database, it's crontab init for first init database you need only run spider:run --all and start worker

ottar-eten-yod commented 2 years ago

Indeed so, but the commands listed add the correct Cron commands.

(crontab -l ; echo "0 0 1 */3 * /var/www/popcorntime/bin/console spider:run --all")| crontab -
(crontab -l ; echo "0 0 * * * /var/www/popcorntime/bin/console spider:run --all --last=48")| crontab -
(crontab -l ; echo "0 8 * * 1 /var/www/popcorntime/bin/console update:stat")| crontab -
(crontab -l ; echo "0 3,11,19 * * * /var/www/popcorntime/bin/console update:trending")| crontab -
(crontab -l ; echo "0 1 * * * /var/www/popcorntime/bin/console update:syncOld 500 --days-check=180 --days-delete=360")| crontab -
(crontab -l ; echo "0 23 * * * /var/www/popcorntime/bin/console cache:clear")| crontab -
(crontab -l ; echo "9  * * * * cd /var/www/popcorntime/ && killall -9 php")| crontab -
(crontab -l ; echo '10  * * * * cd /var/www/popcorntime/ && pgrep -c -f enqueue:consume || bin/console enqueue:consume --time-limit="now + 55 minutes" --no-debug --memory-limit=200')| crontab -

All of those commands will add everything to the Crontab.

[root@testvps popcorntime]# crontab -l
0 0 1 */3 * /var/www/popcorntime/bin/console spider:run --all
0 0 * * * /var/www/popcorntime/bin/console spider:run --all --last=48
0 8 * * 1 /var/www/popcorntime/bin/console update:stat
0 1 * * * /var/www/popcorntime/bin/console update:syncOld 500 --days-check=180 --days-delete=360
0 23 * * * /var/www/popcorntime/bin/console cache:clear
9  * * * * cd /var/www/popcorntime/ && killall -9 php
10  * * * * cd /var/www/popcorntime/ && pgrep -c -f enqueue:consume || bin/console enqueue:consume --time-limit="now + 55 minutes" --no-debug --memory-limit=200
0 3,11,19 * * * /var/www/popcorntime/bin/console update:trending
harisnaeemofficial commented 2 years ago

Yes now this is my crontab -l command result

0 0 1 /3 /var/www/popcorntime/bin/console spider:run --all 0 0 /var/www/popcorntime/bin/console spider:run --all --last=48 0 8 1 /var/www/popcorntime/bin/console update:stat 0 3,11,19 /var/www/popcorntime/bin/console update:trending 0 1 /var/www/popcorntime/bin/console update:syncOld 500 --days-check=180 --days-delete=360 0 23 /var/www/popcorntime/bin/console cache:clear 9 cd /var/www/popcorntime/ && killall -9 php 10 cd /var/www/popcorntime/ && pgrep -c -f enqueue:consume || bin/console enqueue:consume --time-limit="now + 55 minutes" --no-debug --memory-limit=200

harisnaeemofficial commented 2 years ago

Getting this error using command bin/console update:stat

[info] User Deprecated: The "Sentry\SentryBundle\Tracing\Doctrine\DBAL\TracingServerInfoAwareDriverConnection" class implements "Doctrine\DBAL\Driver\ServerInfoAwareConnection" that is deprecated The methods defined in this interface will be made part of the {@see Driver} interface in the next major release. 2022-10-01T19:13:57+00:00 [info] Deprecated: igbinary_serialize(): Cannot serialize resource(stream) and resources may be converted to objects that cannot be serialized in future php releases. Serializing the value as null instead 2022-10-01T19:13:57+00:00 [info] Deprecated: igbinary_serialize(): Cannot serialize resource(stream) and resources may be converted to objects that cannot be serialized in future php releases. Serializing the value as null instead

ottar-eten-yod commented 2 years ago

That is depreciation warnings from PHP, when Ivan has time they are going to work on updating everything but currently they cannot. I will see what I can contribute and understand of the code.

ottar-eten-yod commented 2 years ago

@harisnaeemofficial If you run the following command it should fix those errors. I am also going to work on update documentation.

cd /var/www/popcorntime/
composer update

There has been quite a few composer plugin updates.

ottar-eten-yod commented 2 years ago

Also, @ivan1986 is the scraping meant to be happening through TOR? Since I noticed that when I try it on certain networks with those websites blocked they do not want to work. But TOR definitely works. Any ideas on how I can help you debug this?

ottar-eten-yod commented 2 years ago

Original Issue Fixed. Will create new issues if TOR issue can be replicated.