{"id":18626332,"url":"https://github.com/maciekt07/spotifyadblock","last_synced_at":"2025-04-11T05:30:58.300Z","repository":{"id":46115148,"uuid":"423232576","full_name":"maciekt07/SpotifyAdBlock","owner":"maciekt07","description":"Adblock+ Now Playing for Spotify (for research purposes only plz dont sue me) ","archived":false,"fork":false,"pushed_at":"2021-12-18T12:45:45.000Z","size":479,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T09:47:47.956Z","etag":null,"topics":["advertisement","console-app","console-application","csharp","delay","dotnet","now-playing","process","process-manager","processes","spotify","spotify-api","spotify-free","spotify-freemium","task-manager","while","while-loop","windows"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maciekt07.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-31T18:44:28.000Z","updated_at":"2024-12-21T12:51:00.000Z","dependencies_parsed_at":"2022-08-30T18:01:48.578Z","dependency_job_id":null,"html_url":"https://github.com/maciekt07/SpotifyAdBlock","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciekt07%2FSpotifyAdBlock","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciekt07%2FSpotifyAdBlock/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciekt07%2FSpotifyAdBlock/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maciekt07%2FSpotifyAdBlock/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maciekt07","download_url":"https://codeload.github.com/maciekt07/SpotifyAdBlock/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248347367,"owners_count":21088628,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["advertisement","console-app","console-application","csharp","delay","dotnet","now-playing","process","process-manager","processes","spotify","spotify-api","spotify-free","spotify-freemium","task-manager","while","while-loop","windows"],"created_at":"2024-11-07T04:37:44.937Z","updated_at":"2025-04-11T05:30:58.032Z","avatar_url":"https://github.com/maciekt07.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SpotifyAdBlock\nGet currently played Spotify song name and block ads by using C# console app / Get processes by name method\n![preview](https://raw.githubusercontent.com/maciekkoks/SpotifyBlockAds/main/img/app-preview1.png)\n# Ads skipping\n![ads](https://raw.githubusercontent.com/maciekkoks/SpotifyBlockAds/main/img/ads-skip.png)\n# Memory Usage\n![memory](https://raw.githubusercontent.com/maciekkoks/SpotifyBlockAds/main/img/memory-usage.png)\n\n# Main C# Code\n```cs\nusing System;\nusing System.Diagnostics;\nusing System.Linq;\nusing System.Runtime.InteropServices;\nusing System.Threading;\n\nnamespace SpotifyNowPlaying\n{\n    class Program\n    {\n        [DllImport(\"user32.dll\")]\n\n        public static extern void keybd_event(byte virtualKey, byte scanCode, uint flags, IntPtr extraInfo);\n        public static int a = 0;\n        static void Main(string[] args)\n        {\n            Console.ForegroundColor = ConsoleColor.Green;\n            Console.WriteLine(\"Spotify AdBlocker + Now Playing\");\n            Console.ForegroundColor = ConsoleColor.Magenta;\n            Console.WriteLine(\"Author: github.com/maciekkoks\");\n            Console.ForegroundColor = ConsoleColor.White;\n            Console.WriteLine();\n\n            while (true)\n            {\n                Console.ForegroundColor = ConsoleColor.White;\n                var proc = Process.GetProcessesByName(\"Spotify\").LastOrDefault(p =\u003e !string.IsNullOrWhiteSpace(p.MainWindowTitle));\n                if (proc == null)\n                {\n                    Console.ForegroundColor = ConsoleColor.Red;\n                    Console.WriteLine(\"Spotify is not running\");\n                    System.Diagnostics.Process.Start(\"Spotify.exe\");\n                    Console.ResetColor();\n                    Thread.Sleep(1000);\n                    continue;                     \n                }\n                if (proc.MainWindowTitle == \"Advertisement\" || proc.MainWindowTitle == \"Spotify\")\n                {\n                    foreach (var process in Process.GetProcessesByName(\"Spotify\"))\n                    {\n                        process.Kill();\n                    }\n                    System.Diagnostics.Process.Start(\"Spotify.exe\");\n                    Thread.Sleep(2000);\n                    keybd_event(0xB3, 0, 1, IntPtr.Zero);\n                    Console.ForegroundColor = ConsoleColor.DarkYellow;\n                    Console.WriteLine(\"Advertisement skipped\");\n                    a++;\n                    Console.ResetColor();\n                    while (proc.MainWindowTitle == \"Spotify\"){Thread.Sleep(1000);}\n                }\n                if (proc != null)\n                {\n                    if (proc.MainWindowTitle != \"Spotify Free\")\n                    {\n                        Console.Title = \" Spotify AdBlocker - \" + \"Advertisements skipped: \" + a + \"                     \" + proc.MainWindowTitle;\n                        Console.WriteLine(\"[\" + DateTime.Now.ToString(\"HH:mm:ss\", System.Globalization.DateTimeFormatInfo.InvariantInfo) + \"]  \" + proc.MainWindowTitle);\n                    }\n                    else\n                    {\n                        Console.WriteLine(\"[\" + DateTime.Now.ToString(\"HH:mm:ss\", System.Globalization.DateTimeFormatInfo.InvariantInfo) + \"]  \" + \"Spotify (Paused)\");\n                        Console.Title = \" Spotify AdBlocker - \" + \"Advertisements skipped: \" + a + \"                     \" + \"Spotify (Paused)\";\n                    }\n                    Thread.Sleep(1000);\n                }\n            }\n        }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciekt07%2Fspotifyadblock","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaciekt07%2Fspotifyadblock","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaciekt07%2Fspotifyadblock/lists"}