| ❗ Este proyecto ya no se mantiene después de que Naver ha adquirido Weverse. Cambiaron por completo su API, y no tengo tiempo para hacer otro envoltorio. ❗ |
|---|
Weverse crea caché interno para las comunidades que un usuario sigue en weverse.io.
Este es un envoltorio para la API privada de Weverse, pero puede denominarse API en este repositorio.
Se puede encontrar un bot de discordia Weverse aquí
En un terminal, escriba pip install weverse .
Para instalar desde la fuente:
pip install git+https://github.com/MujyKun/Weverse.git
En primer lugar, se necesita el token de su cuenta (deberá actualizarse cada 6 meses IIRC).
Tenga en cuenta que ahora es posible iniciar sesión utilizando un nombre de usuario y una contraseña sin un token. Esto evitará actualizaciones manuales.
Para obtener el token de su cuenta, vaya a Weverse e inspeccione el elemento (F12).
Luego vaya a la pestaña Network y filtre por XHR . Luego, actualice su página (F5) y busque info o me bajo XHR .
Bajo encabezados, desplácese hasta la parte inferior y vea los encabezados de solicitud. Desea copiar toda authorization: Bearer .
Por ejemplo, puede ver (esto es solo un ejemplo):
authorization: Bearer ABCDEFGHIJKLMNOPQRSTUVWXYZ
Entonces ABCDEFGHIJKLMNOPQRSTUVWXYZ sería su token de autenticación para Weverse. Se sugiere tener el token de autenticación como una variable de entorno.
Nota importante: No se pueden realizar un seguimiento de todas las frases clave coreanas. Desplácese hasta la parte inferior de la página de Weverse
Cuando haya iniciado sesión y haga clic en "Inglés" para establecer el idioma de la cuenta en 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. Ejemplo asincrónico más detallado
Ejemplo sincrónico más detallado