```python
if transcript_format == 'txt':
  text = SubRipFile.from_string(data.decode('utf8'))
  srt_subs = HTMLParser().unescape("\n".join(text))
else:
  srt_subs = generate_srt_from_sjson(json.loads(data), speed=1.0)
```
This code duplicates lines 356-360. Could you move it into helper function?