mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-17 15:09:31 +00:00
remove some words
This commit is contained in:
@@ -1,29 +1,29 @@
|
|||||||
from rsshub.utils import DEFAULT_HEADERS
|
from rsshub.utils import DEFAULT_HEADERS
|
||||||
from rsshub.utils import fetch
|
from rsshub.utils import fetch
|
||||||
|
|
||||||
domain = 'https://www.benzinga.com'
|
domain = 'https://www.benzinga.com'
|
||||||
|
|
||||||
def ctx(category=''):
|
def ctx(category=''):
|
||||||
|
|
||||||
stock = category
|
stock = category
|
||||||
|
|
||||||
def parse(post):
|
def parse(post):
|
||||||
item = {}
|
item = {}
|
||||||
item['description'] = item['title'] = stock.upper() + '的评级:' + ', '.join(post.css('td::text').extract())
|
item['description'] = item['title'] = stock.upper() + '的评级:' + ', '.join(post.css('td::text').extract())
|
||||||
item['link'] = url
|
item['link'] = url
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
url = f'{domain}/stock/{category}/ratings'
|
url = f'{domain}/stock/{category}/ratings'
|
||||||
tree = fetch(url, headers=DEFAULT_HEADERS)
|
tree = fetch(url, headers=DEFAULT_HEADERS)
|
||||||
posts = tree.css('tbody tr')
|
posts = tree.css('tbody tr')
|
||||||
items = list(map(parse, posts))
|
items = list(map(parse, posts))
|
||||||
|
|
||||||
column_title = tree.css('title::text').extract_first()
|
column_title = tree.css('title::text').extract_first()
|
||||||
return {
|
return {
|
||||||
'title': f'{column_title} - benzinga',
|
'title': f'{column_title} - benzinga',
|
||||||
'description': f'{column_title} - benzinga',
|
'description': f'{column_title} - benzinga',
|
||||||
'link': url,
|
'link': url,
|
||||||
'author': f'hillerliao',
|
'author': f'hillerliao',
|
||||||
'items': items
|
'items': items
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,26 @@
|
|||||||
from rsshub.utils import fetch
|
from rsshub.utils import fetch
|
||||||
from rsshub.utils import DEFAULT_HEADERS
|
from rsshub.utils import DEFAULT_HEADERS
|
||||||
|
|
||||||
domain = 'https://www.chaindd.com'
|
domain = 'https://www.chaindd.com'
|
||||||
|
|
||||||
|
|
||||||
def parse(post):
|
def parse(post):
|
||||||
item = {}
|
item = {}
|
||||||
item['title'] = post.css('a::text').extract_first()
|
item['title'] = post.css('a::text').extract_first()
|
||||||
item['description'] = post.css('p::text').extract_first()
|
item['description'] = post.css('p::text').extract_first()
|
||||||
item['link'] = f"{domain}{post.css('a::attr(href)').extract_first()}"
|
item['link'] = f"{domain}{post.css('a::attr(href)').extract_first()}"
|
||||||
item['author'] = post.css('a.name::text').extract_first()
|
item['author'] = post.css('a.name::text').extract_first()
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
def ctx(category=''):
|
def ctx(category=''):
|
||||||
DEFAULT_HEADERS.update({'Referer': f'https://www.chaindd.com/column/{category}'})
|
DEFAULT_HEADERS.update({'Referer': f'https://www.chaindd.com/column/{category}'})
|
||||||
tree = fetch(f"{domain}/column/{category}")
|
tree = fetch(f"{domain}/column/{category}")
|
||||||
posts = tree.css('li .cont')
|
posts = tree.css('li .cont')
|
||||||
return {
|
return {
|
||||||
'title': f'链得得栏目{category}最新文章',
|
'title': f'链得得栏目{category}最新文章',
|
||||||
'link': f'{domain}/column/{category}',
|
'link': f'{domain}/column/{category}',
|
||||||
'description': f'链得得栏目{category}最新文章',
|
'description': f'链得得栏目{category}最新文章',
|
||||||
'author': 'hillerliao',
|
'author': 'hillerliao',
|
||||||
'items': list(map(parse, posts))
|
'items': list(map(parse, posts))
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,15 +1,15 @@
|
|||||||
import random
|
import random
|
||||||
import linecache
|
import linecache
|
||||||
import sys
|
import sys
|
||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
file_path = path.dirname(path.realpath(__file__))
|
file_path = path.dirname(path.realpath(__file__))
|
||||||
|
|
||||||
def ctx():
|
def ctx():
|
||||||
file = path.join(file_path,'toeflwords.txt')
|
file = path.join(file_path,'toeflwords.txt')
|
||||||
with open(file, encoding='utf-8') as inf:
|
with open(file, encoding='utf-8') as inf:
|
||||||
f = inf.readlines()
|
f = inf.readlines()
|
||||||
count = len(f)
|
count = len(f)
|
||||||
wordnum = random.randrange(0, count, 1)
|
wordnum = random.randrange(0, count, 1)
|
||||||
word = linecache.getline(file, wordnum)
|
word = linecache.getline(file, wordnum)
|
||||||
return {"word": word}
|
return {"word": word}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h3>{{ word }}</h3>
|
<h3>{{ word }}</h3>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user