Home > Software engineering >  File not downloaded m3u
File not downloaded m3u

Time:12-23

I created a python script to download m3u file unfortunately the file and empty

import os, sys, re, time, os

LINKFILE= '/tmp/link'
M3UPATH= '/tmp/IPTVWORLD73.m3u'

link = 'http://xtremity.tv/get.php?username=5686626928&password=7936628346&type=m3u_plus&output=ts'

os.system('curl -H "Connection: keep-alive" -H "Content-Type: application/json"  --limit-rate 100K    -n -s -k -Lbk -A -k -m 8 -m 52 %s -o %s > /dev/null 2>&1' % (url, M3UPATH))          

I tried that but still the same problem the file is empty

import urllib.request

#wget.download(url, M3UPATH)
urllib.request.urlretrieve(url, M3UPATH)

CodePudding user response:

Reproduced with curl on shell

A simple curl to test for the response-headers -I showed OK:

curl -I "http://xtremity.tv/get.php?username=5686626928&password=7936628346&type=m3u_plus&output=ts"

Output:

HTTP/1.1 200 OK
Server: nginx
Date: Thu, 22 Dec 2022 20:11:10 GMT
Content-Type: application/octet-stream
Content-Length: 0
Connection: keep-alive

Then downloading to a file using -o <file> has written 139M to disk successfully:

curl -o "Downloads/SO_xtremityTv.ts" "http://xtremity.tv/get.php?username=5686626928&password=7936628346&type=m3u_plus&output=ts"

CodePudding user response:

if not os.path.exists(M3UPATH):
    os.system('curl -o %s %s' % (M3UPATH, url))

Still the same empty file problem I am using a python script

#!/bin/bash
# -*- coding: utf-8 -*-
LINE="************************************************************"
python <<'EOF' 
.
.
.
.
..
EOF

exit 0  
  • Related