Browse Source

now grabs the cookieID from the website since this changes regularly

pull/7126/head
geogolem 8 years ago
parent
commit
6b383d8d7d
  1. 13
      couchpotato/core/media/movie/providers/info/couchpotatoapi.py

13
couchpotato/core/media/movie/providers/info/couchpotatoapi.py

@ -2,6 +2,7 @@ import base64
import time
import json
import requests
import urllib
from datetime import date
from couchpotato.core.event import addEvent, fireEvent
@ -189,6 +190,14 @@ class CouchPotatoApi(MovieProvider):
url = 'https://www.allflicks.net/wp-content/themes/responsive/processing/processing_%s.php?draw=9&columns[0][data]=box_art&columns[0][name]=&columns[0][searchable]=true&columns[0][orderable]=false&columns[0][search][value]=&columns[0][search][regex]=false&columns[1][data]=title&columns[1][name]=&columns[1][searchable]=true&columns[1][orderable]=true&columns[1][search][value]=&columns[1][search][regex]=false&columns[2][data]=year&columns[2][name]=&columns[2][searchable]=true&columns[2][orderable]=true&columns[2][search][value]=&columns[2][search][regex]=false&columns[3][data]=genre&columns[3][name]=&columns[3][searchable]=true&columns[3][orderable]=true&columns[3][search][value]=&columns[3][search][regex]=false&columns[4][data]=rating&columns[4][name]=&columns[4][searchable]=true&columns[4][orderable]=true&columns[4][search][value]=&columns[4][search][regex]=false&columns[5][data]=available&columns[5][name]=&columns[5][searchable]=true&columns[5][orderable]=true&columns[5][search][value]=&columns[5][search][regex]=false&columns[6][data]=director&columns[6][name]=&columns[6][searchable]=true&columns[6][orderable]=true&columns[6][search][value]=&columns[6][search][regex]=false&columns[7][data]=cast&columns[7][name]=&columns[7][searchable]=true&columns[7][orderable]=true&columns[7][search][value]=&columns[7][search][regex]=false&order[0][column]=5&order[0][dir]=desc&start=%s&length=%s&search[value]=%s&search[regex]=false&movies=true&shows=false&documentaries=true&rating=netflix&min=1900&max=%s&_=1478945015662'
log.debug('-------------->querying Allflicks for title: %s' %title)
sock=urllib.urlopen("http://allflicks.net")
htmlSource=sock.read()
sock.close()
tag='document.cookie = \"identifier='
index=htmlSource.find(tag)+len(tag)
cookid = "identifier="+htmlSource[index:htmlSource.find('\"+expires+\"; path=/; domain=.allflicks.net\"')]
#log.debug('cookid=%s', cookid)
#Please note if allflicks has the name listd with the wrong name,
# or imdb has the movie with a different title. This check will fail and
# the movie will not be reported as being on netflix when in fact it is.
@ -208,14 +217,14 @@ class CouchPotatoApi(MovieProvider):
response = session.get(url % (countryCode,str(start),str(length),titleForNetflix,str(now_year)),headers={"Accept" : "application.json, text/javascript, */*; q=0.01",
"X-Requested-With": "XMLHttpRequest",
"Referer": "http://www.allflicks.net/canada/",
"Cookie": "identifier=586e9d1655645",
"Cookie": cookid,
"Host": "www.allflicks.net"})
else:
session.get("http://www.allflicks.net/")
response = session.get(url % (countryCode,str(start),str(length),titleForNetflix,str(now_year)),headers={"Accept" : "application/json, text/javascript, */*; q=0.01",
"X-Requested-With": "XMLHttpRequest",
"Referer": "http://www.allflicks.net/",
"Cookie": "identifier=586e9d1655645",
"Cookie": cookid,
"Host": "www.allflicks.net"})
j1= response.json()

Loading…
Cancel
Save