New mod: VideoPlayerCookies

This commit is contained in:
SDraw 2025-03-04 23:25:04 +03:00
parent c4c3cca728
commit 60fb594210
No known key found for this signature in database
GPG key ID: BB95B4DAB2BB8BB5
6 changed files with 97 additions and 0 deletions

View file

@ -12,4 +12,5 @@ Merged set of MelonLoader mods for ChilloutVR.
|[Player Movement Copycat](/ml_pmc/README.md)|1.1.0 [:arrow_down:](../../releases/latest/download/PlayerMovementCopycat.dll)|
|[Player Ragdoll Mod](/ml_prm/README.md)|1.2.2 [:arrow_down:](../../releases/latest/download/PlayerRagdollMod.dll)|
|[Players Instance Notifier](/ml_pin/README.md)|1.1.0 [:arrow_down:](../../releases/latest/download/PlayersInstanceNotifier.dll)|
|[Video Player Cookies](/ml_vpc/README.md)|1.0.0 [:arrow_down:](../../releases/latest/download/VideoPlayerCookies.dll)|
|[Vive Extended Input](/ml_vei/README.md)|1.1.0 [:arrow_down:](../../releases/latest/download/ViveExtendedInput.dll)|

View file

@ -26,6 +26,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_dht", "ml_dht\ml_dht.csp
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_bft", "ml_bft\ml_bft.csproj", "{331C995D-9648-44AD-8B02-D5F3A89FDC1F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ml_vpc", "ml_vpc\ml_vpc.csproj", "{7CF37B93-9341-422D-845C-9AB96DB4D0A1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@ -65,6 +67,10 @@ Global
{331C995D-9648-44AD-8B02-D5F3A89FDC1F}.Debug|x64.ActiveCfg = Debug|x64
{331C995D-9648-44AD-8B02-D5F3A89FDC1F}.Release|x64.ActiveCfg = Release|x64
{331C995D-9648-44AD-8B02-D5F3A89FDC1F}.Release|x64.Build.0 = Release|x64
{7CF37B93-9341-422D-845C-9AB96DB4D0A1}.Debug|x64.ActiveCfg = Debug|x64
{7CF37B93-9341-422D-845C-9AB96DB4D0A1}.Debug|x64.Build.0 = Debug|x64
{7CF37B93-9341-422D-845C-9AB96DB4D0A1}.Release|x64.ActiveCfg = Release|x64
{7CF37B93-9341-422D-845C-9AB96DB4D0A1}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

26
ml_vpc/Main.cs Normal file
View file

@ -0,0 +1,26 @@
using ABI_RC.VideoPlayer;
using System.Reflection;
using System.IO;
namespace ml_vpc
{
public class VideoPlayerCookies : MelonLoader.MelonMod
{
static string ms_cookiesPath;
public override void OnInitializeMelon()
{
HarmonyInstance.Patch(typeof(YoutubeDl).GetMethod("GetVideoMetaDataAsync", BindingFlags.NonPublic | BindingFlags.Static),
new HarmonyLib.HarmonyMethod(typeof(VideoPlayerCookies).GetMethod(nameof(OnGetYoutubeVideoMetaData_Prefix), BindingFlags.NonPublic | BindingFlags.Static))
);
ms_cookiesPath = Path.Combine(MelonLoader.Utils.MelonEnvironment.UserDataDirectory, "cookies.txt");
}
static void OnGetYoutubeVideoMetaData_Prefix(ref string parameter)
{
if(File.Exists(ms_cookiesPath))
parameter += string.Format(" --cookies \"{0}\"", ms_cookiesPath);
}
}
}

View file

@ -0,0 +1,4 @@
[assembly: MelonLoader.MelonInfo(typeof(ml_vpc.VideoPlayerCookies), "VideoPlayerCookies", "1.0.0", "SDraw", "https://github.com/SDraw/ml_mods_cvr")]
[assembly: MelonLoader.MelonGame(null, "ChilloutVR")]
[assembly: MelonLoader.MelonPlatform(MelonLoader.MelonPlatformAttribute.CompatiblePlatforms.WINDOWS_X64)]
[assembly: MelonLoader.MelonPlatformDomain(MelonLoader.MelonPlatformDomainAttribute.CompatibleDomains.MONO)]

17
ml_vpc/README.md Normal file
View file

@ -0,0 +1,17 @@
# Video Player Cookies
This mod allows yt-dlp to use cookies for playing YouTube videos.
# Installation
* Install [latest MelonLoader](https://github.com/LavaGang/MelonLoader)
* Get [latest release DLL](../../../releases/latest):
* Put `VideoPlayerCookies.dll` in `Mods` folder of game
# Usage
* Acquire cookies for YouTube from your browser:
* Chromium based browsers: [Get cookies.txt LOCALLY](https://chromewebstore.google.com/detail/get-cookiestxt-locally/cclelndahbckbenkjhflpdbgdldlbecc) extension
* Firefox based browsers: [cookies.txt](https://addons.mozilla.org/en-US/firefox/addon/cookies-txt) extension
* Save result as file named `cookies.txt` in `<game_folder>/UserData` folder
# Notes
* After first use yt-dlp will remove unnecessary cookies from file automatically.
* Cookies contain private information and access linked to your YouTube account, **do not share it to anyone**.

43
ml_vpc/ml_vpc.csproj Normal file
View file

@ -0,0 +1,43 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Platforms>x64</Platforms>
<AssemblyName>VideoPlayerCookies</AssemblyName>
<Authors>SDraw</Authors>
<Company>SDraw</Company>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /y &quot;$(TargetPath)&quot; &quot;D:\Games\Steam\steamapps\common\ChilloutVR\Mods\&quot;" />
</Target>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\net35\0Harmony.dll</HintPath>
<Private>false</Private>
<SpecificVersion>false</SpecificVersion>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\Assembly-CSharp.dll</HintPath>
<Private>false</Private>
<SpecificVersion>false</SpecificVersion>
</Reference>
<Reference Include="MelonLoader">
<HintPath>D:\Games\Steam\steamapps\common\ChilloutVR\MelonLoader\net35\MelonLoader.dll</HintPath>
<Private>false</Private>
<SpecificVersion>false</SpecificVersion>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>D:\Games\Steam\steamapps\common\ChilloutVR\ChilloutVR_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>false</Private>
<SpecificVersion>false</SpecificVersion>
</Reference>
</ItemGroup>
</Project>