Package: easy-twitter-publisher
easy_twitter_publisher推特（Twitter）发帖回帖程序，支持本地及url图文（jpg,png,gif）,视频（mp4），希望能为使用者带来益处。如果您也想贡献好的代码片段，请将代码以及描述，通过邮箱（xinkonghan@gmail.com）发送给我。代码格式是遵循自我主观，如存在不足敬请指出！**文档地址：
**https://easy-twitter-publisher.xink.top/**PyPi地址：
**https://pypi.org/project/easy-twitter-publisher**GitHub地址：
**https://github.com/hanxinkong/easy-twitter-publisher推特三件套（有需要可自行安装）easy_twitter_publisher推特发帖,回帖,转载https://pypi.org/project/easy_twitter_publishereasy_twitter_crawler推特采集https://pypi.org/project/easy-twitter-crawlereasy_twitter_interactors推特互动（点赞,刷阅读量等）https://pypi.org/project/easy_twitter_interactors安装pip install easy-twitter-publisher主要功能media_upload媒体文件上传（本地图片或视频）media_upload_from_url媒体文件上传（url链接，仅支持gif及视频）post发帖（支持文本，图片，视频）reply回帖（支持文本，图片，视频）简单使用设置代理及cookie (发帖和回帖均需要设置cookie)proxy={'http':'http://127.0.0.1:10808','https':'http://127.0.0.1:10808'}cookie='auth_token=686fa28f49400698820d0a3c344c51efdeeaf73a; ct0=5bed99b7faad9dcc742eda564ddbcf37888f8794abd6d4d736919234440be2172da1e9a9fc48bb068db1951d1748ba5467db2bc3e768f122794265da0a9fa6135b4ef40763e7fd91f730d0bb1298136b'媒体上传使用案例（内容需要图片或视频时使用此方法）fromeasy_spider_toolimportformat_jsonfromeasy_twitter_publisherimportTwitterMedia,get_headerstwitter_media=TwitterMedia()twitter_media.set_headers(get_headers(cookie))twitter_media.set_proxy(proxy)# 本地文件media_info=twitter_media.media_upload(r'0.gif')# 图片链接# twitter_media.media_upload_from_url('https://th.bing.com/th/id/R.466bb61cd7cf4e8b7d9cdf645add1d6e?rik=YRZKRLNWLutoZA&riu=http%3a%2f%2f222.186.12.239%3a10010%2fwmxs_161205%2f002.jpg&ehk=WEy01YhyfNzzQNe1oIqxwgbTnzY7dMfmZZHkqpZB5WI%3d&risl=&pid=ImgRaw&r=0')print(format_json(media_info))媒体上传参数说明字段名类型必须描述media_pathstring是媒体文件路径发帖使用案例（指定文本，图片发帖子）fromeasy_spider_toolimportformat_jsonfromeasy_twitter_publisherimportTwitterPost,get_headerstwitter_post=TwitterPost()twitter_post.set_headers(get_headers(cookie))twitter_post.set_proxy(proxy)post_info=twitter_post.post(text="""Hi, I'm Han Xinkong""",# medias=[twitter_media.media_id])print(format_json(post_info))发帖参数说明字段名类型必须描述textstring是文本（最多不超过个字符，包括空格回车）mediaslist否媒体文件上传后的媒体id（可指定多个）回帖使用案例（指定目标帖子，对其回帖）fromeasy_spider_toolimportformat_jsonfromeasy_twitter_publisherimportTwitterPost,get_headerstwitter_post=TwitterPost()twitter_post.set_headers(get_headers(cookie))twitter_post.set_proxy(proxy)reply_info=twitter_post.reply(to_tweet_id='1690065356495421444',text="""Hi, I'm Han Xinkong""",# medias=[twitter_media.media_id])print(format_json(reply_info))回帖参数说明字段名类型必须描述to_tweet_idstring是目标帖子id（https://twitter.com/elonmusk/status/1690164670441586688中的 1690164670441586688）textstring是文本（最多不超过个字符，包括空格回车）mediaslist否媒体文件上传后的媒体id（可指定多个）依赖内置依赖typingType Hints for Python.osType Hints for Python.imghdrType Hints for Python.mimetypesType Hints for Python.pathlibType Hints for Python.jsonType Hints for Python.第三方依赖loguruAn XPath for JSON.urllib3An XPath for JSON.requestsAn XPath for JSON.requests_toolbeltPython library used for parsing dates from natural language text.easy_spider_toolPython library used for parsing dates from natural language text.注：依赖顺序排名不分先后链接Github：https://github.com/hanxinkong/easy-twitter-publisher在线文档：https://easy-twitter-publisher.xink.top贡献者许可证该项目根据MIT许可条款获得许可.