使用python爬取聚币,云币币种

版权声明:本文为博主原创文章,未经博主允许不得转载。超级无敌帅哥陈 https://blog.csdn.net/ILYPL/article/details/77493988
交易平台上的信息面对于买卖非常重要,又是一个信息可以带来超过20%的涨幅,所以第一时间提取公告信息很重要
import requests
from bs4 import BeautifulSoup

'''
爬取以下内容
1,聚币网官方公告
2,聚币网项目动态
3,聚币网数字货币资讯
4,币久网官方公告
5,云币最新币种
'''

def get_News():
    url1 = "https://www.jubi.com/gonggao/"
    url2 = "https://www.jubi.com/blocknotice/"
    url3 = "https://www.jubi.com/blocknews/"
    url4 = "https://www.btc9.com/Art/index.html"
    url5 = "https://yunbi.zendesk.com/hc/zh-cn/categories/115000861548-%E5%B8%81%E7%A7%8D%E4%BB%8B%E7%BB%8D"

    webdata1 = requests.get(url1).text
    webdata2 = requests.get(url2).text
    webdata3 = requests.get(url3).text
    webdata4 = requests.get(url4).text
    webdata5 = requests.get(url5).text

    soup1 = BeautifulSoup(webdata1,'lxml')
    soup2 = BeautifulSoup(webdata2,'lxml')
    soup3 = BeautifulSoup(webdata3,'lxml')
    soup4 = BeautifulSoup(webdata4,'lxml')
    soup5 = BeautifulSoup(webdata5,'lxml')

    tag1 = soup1.find_all('p',attrs={'class':'list_neirong'})
    tag2 = soup2.find_all('p',attrs={'class':'list_neirong'})
    tag3 = soup3.find_all('p',attrs={'class':'list_neirong'})
    tag4 = soup4.find_all('a',attrs={'class':'pull-left'})
    tag5 = soup5.find_all('a',attrs={'class':'article-list-link'})

    t1 = tag1[0].get_text()
    t2 = tag2[0].get_text()
    t3 = tag3[0].get_text()
    t4 = tag4[0].get_text()
    t5 = tag5[0].get_text()

    hashaki = t1 + ';' + t2 + ';' + t3 + ';' + t4 +';' + t5
    return hashaki

没有更多推荐了,返回首页

私密
私密原因:
请选择设置私密原因
  • 广告
  • 抄袭
  • 版权
  • 政治
  • 色情
  • 无意义
  • 其他
其他原因:
120
出错啦
系统繁忙,请稍后再试