| ❗ Este projeto não está mais sendo mantido depois que o Naver adquiriu o Weverse. Eles trocaram completamente de sua API e eu não tenho tempo para fazer outro invólucro. ❗ |
|---|
Weverse cria cache interno para as comunidades que um usuário segue no weverse.io.
Este é um invólucro para a API privada do Weverse, mas pode ser referido como uma API neste repositório.
Um bot discord weverse pode ser encontrado aqui
Em um terminal, digite pip install weverse .
Para instalar da fonte:
pip install git+https://github.com/MujyKun/Weverse.git
Primeiro, é necessário seu token de conta (precisará ser atualizado a cada 6 meses de IIRC).
Observe que agora é possível fazer login usando um nome de usuário e senha sem um token. Isso impedirá as atualizações manuais.
Para obter o seu token de conta, vá para Weverse e inspecione o elemento (F12).
Em seguida, vá para a guia Network e filtre por XHR . Em seguida, atualize sua página (F5) e procure info ou me em XHR .
Sob os cabeçalhos, role para o fundo e visualize os cabeçalhos da solicitação. Você deseja copiar tudo o que está passando por authorization: Bearer .
Por exemplo, você pode ver (este é apenas um exemplo):
authorization: Bearer ABCDEFGHIJKLMNOPQRSTUVWXYZ
Então ABCDEFGHIJKLMNOPQRSTUVWXYZ seria seu token de autenticação para o Weverse. Sugere -se ter o token de autenticação como uma variável de ambiente.
NOTA IMPORTANTE: Nem todas as frases-chave coreanas podem ser controladas. Role até o fundo da página do Weverse
Quando você estiver conectado e clique em "inglês" para definir o idioma da conta como inglês.
# Asynchronous
import asyncio
import aiohttp
from Weverse . error import InvalidToken
from Weverse . weverseasync import WeverseClientAsync
# THERE IS A MORE DETAILED EXAMPLE IN THE EXAMPLES FOLDER
# https://github.com/MujyKun/Weverse/blob/main/examples/asynchronous.py
token = "fake_token" # REQUIRED
# THE EXAMPLE IN THE EXAMPLES FOLDER WILL SHOW YOU HOW TO LOGIN WITH A USERNAME AND PASSWORD AND SET UP HOOKS.
# It is advised to pass in your own web session as it is not closed in Weverse
web_session = aiohttp . ClientSession () # A session is created by default
weverse_client = WeverseClientAsync ( authorization = token , verbose = True , loop = asyncio . get_event_loop (),
web_session = web_session )
try :
# creates all the cache that is specified. If the create parameters are set to True, they will take a very long time.
await weverse_client . start ( create_old_posts = True , create_media = True )
except InvalidToken :
print ( "Invalid Token" )
# Synchronous
import requests
from Weverse . weversesync import WeverseClientSync
from Weverse . error import InvalidToken
# THERE IS A MORE DETAILED EXAMPLE IN THE EXAMPLES FOLDER
# https://github.com/MujyKun/Weverse/blob/main/examples/synchronous.py
token = "fake_token" # REQUIRED
# THE EXAMPLE IN THE EXAMPLES FOLDER WILL SHOW YOU HOW TO LOGIN WITH A USERNAME AND PASSWORD AND SET UP HOOKS.
# It is advised to pass in your own web session as it is not closed in Weverse
web_session = requests . Session () # A session is created by default
weverse_client = WeverseClientSync ( authorization = token , verbose = True )
try :
# creates all the cache that is specified. If the create parameters are set to True, they will take a very long time.
weverse_client . start ( create_old_posts = True , create_media = True )
except InvalidToken :
print ( "Invalid Token" )
# After calling the start method, you now have all the objects you would want to modify.
# The start method takes in parameters that can disable old posts from loading up
# if only the newer posts are wanted. More info on the documentation. Exemplo assíncrono mais detalhado
Exemplo síncrono mais detalhado