Git Product home page Git Product logo

epg's Introduction

老张的EPG

  • 基于python3django4的节目表数据抓取及发布系统
  • 本人并非专业,很多内容只是为实现功能,可能会有很多BUG,见谅。
  • 不保证后续会更新。
  • DEMO地址:老张的EPG

主要功能

  • 从网上抓取各来源的节目表信息并生成xmltv 格式文件,用于perfect player 等APP直接载入的节目表信息。
  • 后台配置频道获取列表及抓取日志。
  • 抓取失败时自动更换来源。
  • 各数来源提供节目表的频道获取
  • 提供向外发布的接口
  • 使用nginx+uwsgi+MYSQL、普通办公电脑经长期测试,一天DIYP接口访问量可千万以上。

节目表来源

  • 电视猫
  • 搜视
  • 央视
  • 中数
  • **宽频
  • 中华电信
  • 香港有线宽频caletv
  • **四季电视
  • 香港有线宽频i-cable
  • 香港NOWTV
  • 香港无线电视
  • 北京卫视
  • 广东卫视
  • 香港卫视
  • viutv
  • 川流TV
  • myTVSUPER

需求

  • requests
  • django
  • BeautifulSoup

使用方法

默认使用sqlite3 数据库

下载源码

git clone http://github.com/supzhang/

抓取数据

python main.py  #抓取数据并存入数据库,可设置为定时任务
python main.py -channel #抓取所有来源的频道
python main.py -n CCTV1 #单独测试某一频道  

另:抓取的频道会加入Channel_list表,需要自己手动整理进Channel表中才可以抓取 抓取

启动后台及接口

启动后台

python manage.py runserver 0.0.0.0:80

访问

浏览器访问http://127.0.0.1查看已有数据抓取情况。
主页
浏览器访问http://127.0.0.1/admin 打开后台(用户名密码:admin/admin)

  • 后台首页
    后台
  • 频道列表
    频道列表
  • 修改频道
    频道修改
  • DIYP接口http://127.0.0.1/api/diyp/ 需要提供参数?ch=CCTV1&date=20230309

程序配置

util/general 中有大部分配置
crawl_info:需要采集的节目天数、生成xml的天数、是否需要换源等
dirs:生成测试文件目录 chuanliu_Authorization:如果使用川流TV来源,需要提供此信息

其他配置

更改数据库

epg/settings在此文件中修改配置如下:

DATABASES = {
    'default': {
            'ENGINE': 'django.db.backends.mysql',
            'NAME': '数据库名称',
            'USER': '数据库密码',
            'PASSWORD': '数据库密码',
            'HOST': '127.0.0.1',
            'PORT': '3306',
    },
}

增加抓取来源

crawl/spider在此文件夹中复制当前存在的采集程序,对其进行修改,主要设置两个方法get_epgs_xxx,get_channels_xxx crawl/spider/__init__.py 中导入上面设置的方法,并参照其他来源加入:epg_funcs,epg_source,func_args,all

增加其他频道

在后台“频道列表”中增加,“频道来源网站ID:”字段使用<来源名:id>格式设置。


捐赠

如果您觉得本项目对您有所帮助,请您多多支持,您的支持是我最大的动力,多谢。

  • 支付宝
    支付宝
  • 微信
    微信

epg's People

Contributors

supzhang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

epg's Issues

爬虫 出的epg 覆盖的channel 太少

爬虫epg的结构, all 分类xml文件:download/e.xml 只有 74个channel,**和卫视,没有地方台。地方台则只有一个 **教育2台。

只修改了天数限制,其他未做配置。
依赖安装到 python main.py能跑通,似乎有些包没安装,不知道是不是有影响。

请教下电信抓取节目信息的tmpKey的签名方式

抓包结果
Authentication.CTCSetConfig('SessionID','');
tempKey = Authentication.CTCGetConfig('identityEncode');
document.authform.tempKey.value = tempKey;

最新在研究成都电信的节目抓取,因为我们区的时移ip和您的不同,只有自己提取
可以方便告知下tempKey的生成方式吗?网上说SessionID进行md5,但是不对,拆包也没找到这块的代码,或者可以提供思路吗?谢谢

节目来源

你好,可否进一步共享下已整理的节目来源数据?
题外话,很羡慕你们还能有组播信号的,我这组播被干掉了。只能播放单播地址了。

缺乏匹配台标接口

如题,比较需要这个功能,源站这个接口又报错不能用了,所以能否增加这个接口

TVmao几乎不能使用,求解决方法

第 1 次重试失败!spider-tvmao-list index out of range... 7
4-教育2台 更换 tvmao 来源后,获取信息失败,spider-tvmao-HTTPSConnectionPool(host='lighttv.tvmao.com', port=443): Max retries exceeded with url: /qa/qachannelschedule?epgCode=CETV2&op=getProgramByChnid&epgName=&isNew=on&day=8 (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))...,希望解决方法,是python 还缺什么运行库吗?

香港节目

大佬你好,请问还在维护吗?今天下载下来试了一下,香港的节目列表是抓不了了吗?

大佬,你的使用说明太简单了

之前没有接触过py,也没有使用过py爬虫,现在想自己搭建个epg,可是大佬你这个使用说明太简单了点。。。不知道从何下手,不知道如何操作。

使用mysql数据库报错

按照readme中提示配置好epg/settings.py数据库相关选项后启动正常,但是一访问页面后台和前端都会报错

启动时正常

image

访问后页面后:

django.db.utils.ProgrammingError: (1146, "Table 'epg.web_epg' doesn't exist")

前端:

image

后台:

image

epg/settings.py设置如下:

image

另外readme中数据库部分user的值不对,建议修改

image

mod.py为什么获取不了节目信息呢,mod.cht.com.tw网站能打开

错误信息如下:
2023-06-08 21:04:41 166-美食星球頻道-mod 第 1 次重试失败!spider-mod- HTTPSConnectionPool(host='mod.cht.com.tw', port=443): Max retries exceeded with url: /tv/channel.php?id=275&d=1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
2023-06-08 21:04:41 经过1次重试,mod来源未能获取到 166-美食星球頻道 频道数据!尝试更换来源。错误信息:spider-mod- HTTPSConnectionPool(host='mod.cht.com.tw', port=443): Max retries exceeded with url: /tv/channel.php?id=275&d=1 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
2023-06-08 21:04:41 mod来源,全部失败

大佬可以做成docker版的么

业余选手,按照你的说明跑不起来,可能缺一些依赖吧
所以希望出个docker版的,方便小白用户

需求5日节目表,用来看回放

搭建成功了,但不抓取自己新加的频道

我已经搭建成功了,后台也能运行,但是除了原先自带的频道之外,自己新加的频道列表完全不获取,有大佬告诉我,你们部署成功后,后面怎么做的?修改了哪一部分源码?还有就是将数据库有sqlite3修改为自己的mysql是必须的么?

翡翠台节目单结束时间异常

http://epg.51zmt.top:8000/e.xml 中,翡翠台节目单,每个节目的结束时间总是某天的23:59:59,导致无法正常使用。

以今天(2023-05-29)为例:
image

附件是完整的 e.xml ,供参考
e.xml.zip

看了一下代码,tvb爬虫返回的 endtime 总是 None;然后 models.py 有一段处理 endtime 为 None 时赋予 "xxx 23:59:59",看样子应该是走到这个逻辑了
image

不过有另一个地方会自动补全 endtime ,似乎没有起作用
image

最后还是没看出问题在哪,希望作者能修复一下吧,感谢!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.