从CryptoControl API在应用程序中获取加密新闻源的客户端

crypto-news-api的Python项目详细描述


cryptocontrol-python加密新闻api

CryptoControl.ioapi的正式python客户端。cryptocontrol python客户端允许开发人员从世界各地的cryptonews源访问格式丰富的文章。

安装

pip install crypto-news-api

用法

首先,通过访问https://cryptocontrol.io/apis确保您已收到api密钥。使用api密钥,您可以编写以下代码。

fromcrypto_news_apiimportCryptoControlAPI# Connect to the CryptoControl APIapi=CryptoControlAPI("API_KEY_HERE")# Connect to a self-hosted proxy server (to improve performance) that points to cryptocontrol.ioproxyApi=CryptoControlAPI("API_KEY_HERE","http://cryptocontrol_proxy/api/v1/public")# Enable the sentiment datapointsapi.enableSentiment()# Get top newsprint(api.getTopNews())# get latest russian newsprint(api.getLatestNews("ru"))# get top bitcoin newsprint(api.getTopNewsByCoin("bitcoin"))# get top EOS tweetsprint(api.getTopTweetsByCoin("eos"))# get top Ripple reddit postsprint(api.getLatestRedditPostsByCoin("ripple"))# get reddit/tweets/articles in a single combined feed for NEOprint(api.getTopFeedByCoin("neo"))# get latest reddit/tweets/articles (seperated) for Litecoinprint(api.getLatestItemsByCoin("litecoin"))# get details (subreddits, twitter handles, description, links) for ethereumprint(api.getCoinDetails("ethereum"))

可用功能

  • gettopnews(语言?:enum)获取最热门的新闻文章。
  • getlatestnews(lang?:enum)获取最新的新闻文章。
  • gettopNewsbyCategory(语言?:enum)获取按类别分组的新闻文章。
  • gettopNewsbyCoin(硬币:字符串,lang?:enum)从CryptoControl API获取特定硬币的最新文章。
  • getlatestnewsbycoin(硬币:字符串,lang?:enum)获取特定硬币的最新新闻文章。
  • gettopNewsbyCoinCategory(硬币:字符串,lang?:enum)获取按特定硬币类别分组的新闻文章。
  • gettopreditpostsbycoin(硬币:string,lang?:enum)获取特定硬币的顶部reddit贴子
  • getlatestredditpostsbycoin(硬币:string,lang?:enum)获取特定硬币的最新reddit帖子
  • gettopTweetsBycoin(硬币:字符串,lang?:enum)获取特定硬币的热门推文
  • getlatesttweetsbycoin(硬币:字符串,lang?:enum)获取特定硬币的最新推文
  • gettopfeedbycoin(硬币:字符串,lang?:enum)获取特定硬币的组合feed(reddit/tweets/articles)(按时间排序)
  • getlatestfeedbycoin(硬币:字符串,lang?:enum)获取特定硬币的组合提要(reddit/tweets/articles)(按相关性排序)
  • gettopitemsbycoin(硬币:string,lang?:enum)获取特定硬币的reddit/tweets/articles(按时间排序)
  • getlatestitemsbycoin(硬币:string,lang?:enum)获取特定硬币的reddit/tweets/articles(单独的)(按相关性排序)
  • get coin details(coin:string)获取有关特定硬币的所有详细信息(链接、说明、subreddits、twitter等)
  • enablemotion()获取情感数据点

lang允许开发人员选择要获取提要的语言。目前CryptoControl API支持以下语言:

  • 英语(en默认值)
  • 中文/普通话(cn
  • 德语(de
  • 意大利语(it
  • 日语(jp
  • 朝鲜语(ko
  • 葡萄牙语(po
  • 俄语(ru
  • 西班牙语(es

硬币弹头是coinmarketcap api中使用的硬币id。你可以在这里看到硬币的完整列表:https://api.coinmarketcap.com/v1/ticker/?limit=2000

enableSentiment()将告诉crpytocontrol返回带有情感数据点的articles/reddit/twitter(即一篇文章有多少+ve/-ve)。此功能仅适用于CryptoControl premium users

服务器的响应示例

[{"hotness":70862.60323026273,"activityHotness":4.601980262729618,"primaryCategory":"General","words":1444,"similarArticles":[{"_id":"5b363b525b113200191a1d5f","publishedAt":"2018-06-29T13:42:44.000Z","title":"Op-Ed: Challenge of Mining Centralization Unveils Bitcoin’s Elegant Design","url":"https://cryptocontrol.io/r/api/article/5b363b525b113200191a1d5f?ref=5ac11440ec0af7be35528459","source":{"_id":"59d8c361ef8bf95cc2bfb66f","name":"Bitcoin Magazine","url":"https://bitcoinmagazine.com/"},"sourceDomain":"bitcoinmagazine.com","thumbnail":null},{"_id":"5b3865405c5681000f2f7407","publishedAt":"2018-06-30T14:58:00.000Z","title":"Arbitration on a Governed Blockchain: EOS’ Crisis of Dispute Resolution","url":"https://cryptocontrol.io/r/api/article/5b3865405c5681000f2f7407?ref=5ac11440ec0af7be35528459","source":{"_id":"59d70be3ef8bf95cc2aa2b4f","name":"CoinTelegraph","url":"https://cointelegraph.com/"},"sourceDomain":"cointelegraph.com","thumbnail":null}],"coins":[{"_id":"59cb59f9b0836b0a63aebc7c","name":"Ethereum","tradingSymbol":"eth","slug":"ethereum"},{"_id":"59d21e9b83a0523906a45dc5","name":"EOS","slug":"eos","tradingSymbol":"eos"}],"_id":"5b3a2e1b104844000fd64e28","description":"The EOS governance disaster offers a strong reminder of how entrenched human mistrust can be difficult to overcome.","publishedAt":"2018-07-02T12:00:27.000Z","title":"It's Too Soon for On-Chain Governance - CoinDesk","url":"https://cryptocontrol.io/r/api/article/5b3a2e1b104844000fd64e28?ref=5ac11440ec0af7be35528459","source":{"_id":"59ce11393a44cf289a9a71f5","name":"CoinDesk","url":"http://coindesk.com"},"thumbnail":"https://cryptocontrol.io/r/thumbnail/5b3a2e1b104844000fd64e28?ref=5ac11440ec0af7be35528459","sourceName":"CoinDesk","sourceUrl":"http://coindesk.com","sourceDomain":"coindesk.com","originalImageUrl":"https://media.coindesk.com/uploads/2018/06/shutterstock_153840266-e1530230263310.jpg"}]

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在通过url读取csv文件时,我想用数据映射列名   java在没有类型转换的情况下访问父类型的arraylist中的特定子类型方法,子类型的创建只有在运行时才知道   java扩展UIComponentBase时如何保存状态   java如何使用字符串作为Velocity模板?   用于调试远程/本地java应用程序的自定义调试器   JavaFx和浮动按钮   java如何修改列表中的对象?在迭代时扩展MyObject>?   java Spring框架如何避免控制器中的重复代码?   java代码名1 IOS签名   一点Bitly API有Java库吗?   jasper报告将Highcharts图表添加到使用JavaAPI生成的JasperReport模板中   swing如何在java中更改按键的颜色   java Javax Websocket使用路径参数提交登录数据,好的做法?