Skip to content

Commit 9aae5cd

Browse files
committed
feat: make user agent configurable
1 parent 842da9d commit 9aae5cd

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Jef LeCompte
3+
Copyright (c) 2021 Jeffrey LeCompte
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ services:
2121
-I -D -C /config/.zap2xmlrc -o /xmltv/xmltv.xml
2222
SLEEPTIME: 43200 # 12 hours in seconds
2323
TZ: America/New_York
24+
USER_AGENT: "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36" # Optional: customize user agent
2425
volumes:
2526
- /path/to/appdata/zap2xml:/config
2627
- /path/to/appdata/xmltv:/xmltv # nice for mapping other drives to this that may use xmltv.xml

zap2xml.pl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@
7575
$allChan = 0;
7676
$shiftMinutes = 0;
7777

78+
$userAgent = $ENV{USER_AGENT} || 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36';
79+
7880
$outputXTVD = 0;
7981
$lineuptype;
8082
$lineupname;
@@ -909,7 +911,7 @@ sub login {
909911
$ua->conn_cache(LWP::ConnCache->new( total_capacity => undef ));
910912
$ua->cookie_jar(HTTP::Cookies->new);
911913
$ua->proxy(['http', 'https'], $proxy) if defined($proxy);
912-
$ua->agent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36');
914+
$ua->agent($userAgent);
913915
$ua->default_headers->push_header('Accept-Encoding' => 'gzip, deflate');
914916
}
915917

0 commit comments

Comments
 (0)