Python has been removed from macOS, so here’s an updated version that’s pure AppleScript:
use AppleScript version "2.4"
use framework "Foundation"
tell application "EagleFiler"
set _records to selected records of browser window 1
repeat with _record in _records
set _record's title to my titleFromFilename(_record's filename)
end repeat
end tell
on titleFromFilename(_filename)
set _url to my urlFromFilename(_filename)
set _pageString to my (NSString's stringWithContentsOfURL:_url encoding:(my NSUTF8StringEncoding) |error|:(missing value))
return my titleFromPageSource(_pageString)
end titleFromFilename
on urlFromFilename(_filename)
set _regex to my (NSRegularExpression's regularExpressionWithPattern:"(wwdc\\d{4})[-_](.+)_" options:0 |error|:(missing value))
set _nsString to my (NSString's stringWithString:_filename)
set _textCheckingResult to _regex's firstMatchInString:_nsString options:0 range:{0, _nsString's |length|()}
set _year to my captureAt(1, _nsString, _textCheckingResult)
set _session to my captureAt(2, _nsString, _textCheckingResult)
set _urlString to "https://developer.apple.com/videos/play/" & _year & "/" & _session & "/"
return my (NSURL's URLWithString:_urlString)
end urlFromFilename
on titleFromPageSource(_source)
set _regex to my (NSRegularExpression's regularExpressionWithPattern:"<title>(.*?) -" options:0 |error|:(missing value))
set _nsString to my (NSString's stringWithString:_source)
set _textCheckingResult to _regex's firstMatchInString:_nsString options:0 range:{0, _nsString's |length|()}
return my captureAt(1, _nsString, _textCheckingResult)
end titleFromPageSource
on captureAt(_index, _nsString, _textCheckingResult)
set _range to _textCheckingResult's rangeAtIndex:_index
set _group to _nsString's substringWithRange:_range
return _group as Unicode text
end captureAt