GithubHelp home page GithubHelp logo

rss-translate's Introduction

rss-translate's People

Contributors

q1azq1a avatar talengu 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

Watchers

 avatar  avatar

rss-translate's Issues

ATOM is not support well

  • atom is bad now base on an atom paraser to find
    use feedparser
  • fix google translate limit
import feedparser
import googletrans

def translate_rss(source_lang, target_lang, url):
  """Translates an RSS feed to another language.

  Args:
    source_lang: The language of the original RSS feed.
    target_lang: The language to translate the RSS feed to.
    url: The URL of the RSS feed.

  Returns:
    A list of translated RSS items.
  """

  d = feedparser.parse(url)
  items = []
  for item in d.entries:
    title = googletrans.translate(item.title, src=source_lang, dest=target_lang).text
    link = item.link
    description = googletrans.translate(item.summary, src=source_lang, dest=target_lang).text
    guid = item.link
    pubDate = item.modified_parsed
    items.append({
        'title': title,
        'link': link,
        'description': description,
        'guid': guid,
        'pubDate': pubDate,
    })

  return items

RSS翻译的github action脚本使用说明

前言

自动翻译 rss,利用github action开发了一个脚本, 供大家玩乐。

比如将:
http://www.mckinsey.com/insights/rss -> mckinsey_rss.xml
image

操作

将需要翻译的rss 连接放到 test.ini 配置 ,并提交。

name:输出的xml名字
url:需要转换的url
max:输出xml 最大item数
md5:设置为空,计算页面md5是为了不重复下载,不增加rss原始网站的负担。
action:设置语言转换,默认auto转中文。多语言支持 action = “auto”,这里可以换成多种语言,支持语言列表见 pygtrans 如:action = “en->zh-CN”
https://talengu.github.io/rss-translate/ 等待生成连接即可。

注:

需要github账号,修改配置文件。
更新周期为1天,且为随机时间点(避免ip封锁,非新闻的rss一天周期已经可以了,不滥用)。通过github action实现,见 cron_random.py
多语言支持 action = “auto”,这里可以换成多种语言,支持语言列表见 pygtrans 如:action = “en->zh-CN”
欢迎大家使用!!!🐱

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.