Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Citronalco
website2ics
Commits
484ad10b
Commit
484ad10b
authored
Jul 11, 2021
by
Bernhard Geier
Browse files
kap94: skip broken links in calendar
parent
db12138c
Changes
1
Hide whitespace changes
Inline
Side-by-side
kap942ics.pl
View file @
484ad10b
...
...
@@ -12,6 +12,8 @@ use DateTime;
use
Data::
ICal
;
use
Data::ICal::Entry::
Event
;
use
Try::
Tiny
;
use
utf8
;
use
warnings
;
...
...
@@ -56,11 +58,13 @@ for (my $month=0;$month<$MAXMONTHS;$month++) {
my
$description
=
$entry
->
property
('
description
')
->
[
0
]
->
value
;
# if no description but event's url given, get description from url
if
((
!
$description
)
and
(
$url
))
{
$mech
->
get
(
$url
);
my
$tree
=
HTML::
TreeBuilder
->
new_from_content
(
$mech
->
content
());
$entry
->
add_properties
(
'
description
'
=>
join
("
\n
",
map
{
$_
->
as_trimmed_text
(
extra_chars
=>
'
\xA0
');
}
$tree
->
look_down
('
_tag
'
=>
'
div
','
id
'
=>
'
event-single-content
')
->
find
('
p
'))
);
try
{
$mech
->
get
(
$url
);
my
$tree
=
HTML::
TreeBuilder
->
new_from_content
(
$mech
->
content
());
$entry
->
add_properties
(
'
description
'
=>
join
("
\n
",
map
{
$_
->
as_trimmed_text
(
extra_chars
=>
'
\xA0
');
}
$tree
->
look_down
('
_tag
'
=>
'
div
','
id
'
=>
'
event-single-content
')
->
find
('
p
'))
);
};
}
# fix location
$entry
->
add_properties
('
location
'
=>
"
KAP94, Jahnstr. 1a, 85049 Ingolstadt
");
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment