mirror of
https://github.com/iptv-org/epg
synced 2025-12-18 19:36:58 -05:00
tvpassport.com : dynamic cookie handling
This commit is contained in:
@@ -19,10 +19,12 @@ module.exports = {
|
|||||||
'YYYY-MM-DD'
|
'YYYY-MM-DD'
|
||||||
)}`
|
)}`
|
||||||
},
|
},
|
||||||
request: {
|
async request() {
|
||||||
|
return {
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
headers: {
|
headers: {
|
||||||
Cookie: 'cisession=e49ff13191d6875887193cae9e324b44ef85768d;'
|
Cookie: await getCookie()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
parser: function ({ content }) {
|
parser: function ({ content }) {
|
||||||
@@ -106,6 +108,14 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function getCookie() {
|
||||||
|
const res = await axios.get('https://www.tvpassport.com/tv-listings')
|
||||||
|
const setCookie = res.headers['set-cookie']
|
||||||
|
if (!setCookie || setCookie.length === 0) return ''
|
||||||
|
const cookies = setCookie.map(cookie => cookie.split(';')[0])
|
||||||
|
return cookies.join('; ')
|
||||||
|
}
|
||||||
|
|
||||||
function parseDescription($item) {
|
function parseDescription($item) {
|
||||||
return $item('*').data('description')
|
return $item('*').data('description')
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user