Last active
August 7, 2020 18:36
-
-
Save rinsuki/b5d2fc15d0d54d3daa9007d56e02ab09 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from mitmproxy.http import HTTPFlow | |
import requests | |
MYLIST_ID="00000000" # please replace with your mylist id | |
def response(flow: HTTPFlow): | |
if flow.request.method != "POST": | |
return | |
if flow.request.host != "nvapi.nicovideo.jp": | |
return | |
if not flow.request.path.startswith("/v1/users/me/likes/items"): | |
return | |
if flow.response.status_code >= 300: | |
return | |
requests.post(flow.request.url.replace("/likes", "/mylists/" + MYLIST_ID).replace("?videoId", "?itemId"), headers={ | |
"Cookie": flow.request.headers.get("Cookie"), | |
"User-Agent": flow.request.headers.get("User-Agent"), | |
"X-Frontend-Id": flow.request.headers.get("X-Frontend-Id"), | |
"X-Frontend-Version": flow.request.headers.get("X-Frontend-Version"), | |
"X-Request-With": flow.request.headers.get("X-Request-With"), | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment