pythonでモジュールを公開したい
はじめに
pythonでモジュールを公開したいと思ったのですが、pythonもgithubもすべてが初心者of初心者で、まず何をすればいいのか分かりません。とりやえず、mainコードとして書いたのがこちらです。
import requests
from bs4 import BeautifulSoup
from requests_html import HTMLSession
class user:
def get_followers(name):
# aaa = input("username:")
# HTMLの取得(GET)
req = requests.get(f"https://scratch.mit.edu/users/{name}/followers/")
req.encoding = req.apparent_encoding # 日本語の文字化け防止
# HTMLの解析
data = BeautifulSoup(req.text,"html.parser")
items = data.find(class_ = "box-head")
item = items.find("h2")
aaaaa = item.text
j = aaaaa.find("Followers") + 11
mozi = ""
while aaaaa[j] != ")":
mozi = mozi+aaaaa[j]
j += 1
# print(f"フォロワー:{mozi}")
return mozi
def get_following(name):
# aaa = input("username:")
# HTMLの取得(GET)
req = requests.get(f"https://scratch.mit.edu/users/{name}/following/")
req.encoding = req.apparent_encoding # 日本語の文字化け防止
# HTMLの解析
data = BeautifulSoup(req.text,"html.parser")
items = data.find(class_ = "box-head")
item = items.find("h2")
aaaaa = item.text
j = aaaaa.find("Following") + 11
mozi = ""
while aaaaa[j] != ")":
mozi = mozi+aaaaa[j]
j += 1
# print(f"フォロワー:{mozi}")
return mozi
def get_messages(name):
# aaa = input("username:")
# HTMLの取得(GET)
req = requests.get(f"https://api.scratch.mit.edu/users/{name}/messages/count")
req.encoding = req.apparent_encoding # 日本語の文字化け防止
# HTMLの解析
data = BeautifulSoup(req.text,"html.parser")
aaaaa = data.text
j = 9
mozi = ""
while aaaaa[j] != "}":
mozi = mozi+aaaaa[j]
j += 1
# print(f"フォロワー:{mozi}")
return int(mozi)
class project:
def get_loves(id):
# aaa = input("username:")
# HTMLの取得(GET)
req = requests.get(f"https://api.scratch.mit.edu/projects/{id}/")
req.encoding = req.apparent_encoding # 日本語の文字化け防止
# HTMLの解析
data = BeautifulSoup(req.text,"html.parser")
# print(data)
items = data.text
i = 0
while items[i] != "l" or items[i + 1] != "o" or items[i + 2] != "v" or items[i + 3] != "e":
i += 1
i += 7
mozi = ""
while items[i] != ",":
mozi = f"{mozi}{items[i]}"
i += 1
return int(mozi)
def get_favorites(id):
# aaa = input("username:")
# HTMLの取得(GET)
req = requests.get(f"https://api.scratch.mit.edu/projects/{id}/")
req.encoding = req.apparent_encoding # 日本語の文字化け防止
# HTMLの解析
data = BeautifulSoup(req.text,"html.parser")
# print(data)
items = data.text
i = 0
while items[i] != "f" or items[i + 1] != "a" or items[i + 2] != "v" or items[i + 3] != "o":
i += 1
i += 11
mozi = ""
while items[i] != ",":
mozi = f"{mozi}{items[i]}"
i += 1
return int(mozi)
def get_remixes(id):
# aaa = input("username:")
# HTMLの取得(GET)
req = requests.get(f"https://api.scratch.mit.edu/projects/{id}/")
req.encoding = req.apparent_encoding # 日本語の文字化け防止
# HTMLの解析
data = BeautifulSoup(req.text,"html.parser")
# print(data)
items = data.text
i = 0
while items[i] != "r" or items[i + 1] != "e" or items[i + 2] != "m" or items[i + 3] != "i":
i += 1
i += 9
mozi = ""
while items[i] != "}":
mozi = f"{mozi}{items[i]}"
i += 1
return int(mozi)
def get_title(id):
# aaa = input("username:")
# HTMLの取得(GET)
req = requests.get(f"https://api.scratch.mit.edu/projects/{id}/")
req.encoding = req.apparent_encoding # 日本語の文字化け防止
# HTMLの解析
data = BeautifulSoup(req.text,"html.parser")
# print(data)
items = data.text
i = 0
while items[i] != "t" or items[i + 1] != "i" or items[i + 2] != "t" or items[i + 3] != "l":
i += 1
i += 7
mozi = ""
while items[i] != ",":
mozi = f"{mozi}{items[i]}"
i += 1
return mozi
これ以外何もできていません、どうすればよいでしょうか?一応pyplのアカウント登録はできました。
0