Zap2it free TV listings XML is no more. (6 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

Portal Member
April 14, 2025
5
1
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:

antidot

Portal Member
April 9, 2025
21
9
Home Country
United States of America United States of America
For all the Windows users wanting to use a simple .exe to download EPG from Gracenote, here is the freshly compiled file. User agent correction applied, as well.

Cheers

PS It's been reported that when extracting the .exe file from the .zip container the A/V system may complain. It's a false positive, the file is just a recompiled .pl into .exe. May contain libraries that A/V don't like, I don't know. Works for me.
 

Attachments

  • NewZap2xml.zip
    5.3 MB
Last edited:

mrceolla

Portal Pro
December 11, 2010
165
24
Home Country
United States of America United States of America
Sweet! Thanks for sharing. Did you create it? I may give it a try but it's hard to bring myself to mess with something that's working. Maybe I'll switch to your version when I move my MP Server to a new machine which should happen this year.
 

NRivera637

Portal Pro
September 7, 2013
69
8
75
Home Country
United States of America United States of America
20Jun25 : 06:20am :sleep:

Unfortunately, now Gracenote is rotating its IP every few seconds daily and also changing sets from day-to-day so that you cannot capture it is we did a few days ago. Adding all three visible IP addresses to the 'hosts' file as was suggested no longer works either. Replacing 'zap2it' with 'Gracenote' in the ZAP2XML.PL file doesn't want to work. The original Zap2it web listings are available on their new website yes.., and your original Zap2it Login/password do work so you can access listings online. :cry:

But, a solution to download the XML tvguide data still eludes. So the hunt goes on. :mad:

BTW it would be nice if all posts were dated so people don't wind up reading solutions from the year 2016 and which no longer apply. (y)
 

antidot

Portal Member
April 9, 2025
21
9
Home Country
United States of America United States of America
Sorry man, I have no idea what you're talking about. Gracenote can change their IP address every half hour, your DNS server will always provide you with the current one.

Fixed IP through the hosts file was necessary because zap2it.com stopped existing. And, zap2it.com was hard coded into the zap2xml.exe program. There wasn't a way to redirect zap2it.com to gracenote.com, other than modifying the hosts file.

Now, that a new file has been created (by me), the newzap2xml.exe points to gracenote.com, and your DNS server will do the address translation. Keep in mind this a windows executable for a windows environment.

If you want to use the zap2xml.pl file, you'll need a perl environment to execute it. I've only ported the zap2xml.pl file into a windows executable, so you don't need a 1GB Perl environment to execute one file.

You have a different problem than the IP address, my friend. As both my new executable and the .pl version of it work flawlessly.

ALSO, when trying to extract the .exe file from the .zip file, my computer's A/V gave me a false positive. No idea why. Maybe the perl compiler has a code that triggers something. The file is 100% clean, and only goes to gracenote.com, as it is based on the .pl file.

I think compilers "throw" in all the necessary libraries, perl environment or whatever to make the .exe file work on its own. Me thinks....I'm not a programmer.
 
Last edited:

Users who are viewing this thread

Top Bottom