Zap2it free TV listings XML is no more. (4 Viewers)

Airman

Portal Member
April 9, 2025
5
0
Home Country
United States of America United States of America
I upgraded my MP to the latest version 32bit. Maybe I have a corrupted file.
 

luckyj

New Member
April 14, 2025
3
0
Home Country
United States of America United States of America
Did it work?

And sorry, I should have mentioned that I was just running a test with zap2it at the command line. I'm not using MP.
 

smnsparty

New Member
May 3, 2025
1
1
Home Country
United States of America United States of America
Yeah, the IP changes pretty often. I've attached a .bat file that I prompted AI to spit out. It will update a tvlistings.zap2it.com entry in your hosts file with results from nslookup. It needs to be run with admin privileges. I run this via Task Scheduler a couple minutes before I run zap2xml.exe.

Use at your own risk.

I searched for an updated zap2xml.exe file but could only find instructions to compile my own exe that may or may not work correctly and/or cause me to have to redo channel mapping, so I went with this route. If anyone finds a drop-in replacement .exe file please let me know.
This is one of the top search results for WMC having stopped working; thanks everyone for the useful information!

My shell scripting skills are very rusty these days, so for those like me who are still rocking Windows 7's (or some later version of) WMC, I thought I'd post the (rather hacky) Python script I'm using as a drop-in replacement for updating the hosts file and then launching a batch script to download and process the TV guide. In order to run this script, the following assumptions need to be met.
  1. User has Administrator privileges
  2. Python is installed on the system
  3. A batch file named refresh_epg.bat exists in the same folder as the Python script, and the former calls zap2xml.exe, etc., and updates the TV guide
  4. The working folder for the Python script and refresh_epg.bat can be written to, for storing a temporary text file
  5. The hosts file already has an existing entry to redirect from tvlistings.zap2it.com
  6. User creates another small batch script which launches the Python script below, and can execute this batch file as Administrator
IMPORTANT:
  • Please back up your hosts file before trying to run this script, just in case it messes up; use at your own risk
Python:
import subprocess

hosts_path = 'C:/Windows/System32/drivers/etc/hosts'
search_text = '\t\ttvlistings.zap2it.com'

# Look up the current IP addresses, and save them to a text file
subprocess.run(['nslookup', 'tvlistings.gracenote.com', '>', 'temp.txt'], shell=True)
with open('./temp.txt', 'r') as temp_file:
    lines = temp_file.readlines()
temp_file.close()
for line in lines:
    if 'Addresses:  ' in line:
        # Note one of the addresses
        ip_address = line[len('Addresses:  '):-1]
        break
# Load the hosts file
with open(hosts_path, 'r') as target_file:
    lines = target_file.readlines()
target_file.close()
new_text = ''
for line in lines:
    if search_text in line:
        # Replace the old IP address with the new one
        new_text += line.replace(line[:line.find(search_text)], ip_address)
    else:
        new_text += line
# Now open the hosts file for writing and update it
with open(hosts_path, 'w') as target_file:
    target_file.write(new_text)
target_file.close()
# Finally, proceed with downloading the fresh TV Guide information
subprocess.run(['refresh_epg.bat'], shell=True)
NOTE:
  • Lines 3, 4 and 32 may need to be tweaked for your particular use case
  • My hosts file has tab characters for indentation, so they appear within the string on line 4 (others may need to either use spaces or just remove them)
The 'wrapper' batch script would be pretty simple; it would just need to have a command like python update_tv-guide.py (an example name of the above script).

Last but not least, the Task Scheduler entry would need to be updated to point to the wrapper batch script and to have the 'Run with highest privileges' option ticked (Windows will ask for the Administrator password prior to saving the changes).
 
Last edited:

Users who are viewing this thread

Top Bottom