meta_oxide 0.1.1

Universal metadata extraction library supporting 13 formats (HTML Meta, Open Graph, Twitter Cards, JSON-LD, Microdata, Microformats, RDFa, Dublin Core, Web App Manifest, oEmbed, rel-links, Images, SEO) with 7 language bindings
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
"""
Tests for JSON-LD AudioObject type

Tests the extraction of Schema.org AudioObject structured data.
AudioObject is used for audio files, podcasts, music tracks, and audiobooks.
"""

import meta_oxide
import pytest


class TestAudioObjectBasic:
    """Test basic AudioObject extraction"""

    def test_audio_basic_name_only(self):
        """Test minimal audio with name only"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Podcast Episode 1"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["name"] == "Podcast Episode 1"

    def test_audio_with_description(self):
        """Test audio with name and description"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Morning Meditation",
                "description": "A 10-minute guided meditation for starting your day"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["name"] == "Morning Meditation"
        assert objects[0]["description"] == "A 10-minute guided meditation for starting your day"

    def test_audio_with_content_url(self):
        """Test audio with contentUrl"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Example Audio",
                "contentUrl": "https://example.com/audio.mp3"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["contentUrl"] == "https://example.com/audio.mp3"

    def test_audio_with_duration(self):
        """Test audio with ISO 8601 duration"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Short Track",
                "duration": "PT45M"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["duration"] == "PT45M"


class TestAudioObjectEncoding:
    """Test AudioObject encoding and format fields"""

    def test_audio_with_encoding_format(self):
        """Test audio with encodingFormat (MIME type)"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "MP3 Audio",
                "encodingFormat": "audio/mpeg"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["encodingFormat"] == "audio/mpeg"

    def test_audio_with_bitrate(self):
        """Test audio with bitrate"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "High Quality Audio",
                "bitrate": "320 kbps",
                "encodingFormat": "audio/mp3"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["bitrate"] == "320 kbps"
        assert objects[0]["encodingFormat"] == "audio/mp3"

    def test_audio_various_formats(self):
        """Test audio with various encoding formats"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "WAV Recording",
                "encodingFormat": "audio/wav"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["encodingFormat"] == "audio/wav"


class TestAudioObjectUrls:
    """Test AudioObject URL fields"""

    def test_audio_with_urls(self):
        """Test audio with contentUrl, embedUrl, and url"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Sample Audio",
                "contentUrl": "https://example.com/audio.mp3",
                "embedUrl": "https://example.com/player/embed/123",
                "url": "https://example.com/listen/audio-123"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["contentUrl"] == "https://example.com/audio.mp3"
        assert objects[0]["embedUrl"] == "https://example.com/player/embed/123"
        assert objects[0]["url"] == "https://example.com/listen/audio-123"

    def test_audio_with_image_thumbnail(self):
        """Test audio with image/thumbnail URL"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Music Track",
                "image": "https://example.com/cover-art.jpg"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["image"] == "https://example.com/cover-art.jpg"

    def test_audio_with_thumbnail_object(self):
        """Test audio with thumbnail ImageObject"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Audio with Thumbnail",
                "thumbnail": {
                    "@type": "ImageObject",
                    "url": "https://example.com/thumb.jpg"
                }
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        # Complex objects are returned as JSON strings per codebase pattern
        assert "thumbnail" in objects[0]


class TestAudioObjectMetadata:
    """Test AudioObject metadata fields"""

    def test_audio_with_dates(self):
        """Test audio with uploadDate and datePublished"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "New Podcast Episode",
                "uploadDate": "2024-11-07T10:00:00Z",
                "datePublished": "2024-11-07"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["uploadDate"] == "2024-11-07T10:00:00Z"
        assert objects[0]["datePublished"] == "2024-11-07"

    def test_audio_with_author(self):
        """Test audio with author (Person)"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Audiobook Chapter",
                "author": {
                    "@type": "Person",
                    "name": "Jane Author",
                    "url": "https://example.com/authors/jane"
                }
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["name"] == "Audiobook Chapter"
        # Complex objects are returned as JSON strings per codebase pattern
        assert "author" in objects[0]

    def test_audio_with_publisher(self):
        """Test audio with publisher (Organization)"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Corporate Podcast",
                "publisher": {
                    "@type": "Organization",
                    "name": "Podcast Network Inc",
                    "logo": {
                        "@type": "ImageObject",
                        "url": "https://network.com/logo.png"
                    }
                }
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        # Complex objects are returned as JSON strings per codebase pattern
        assert "publisher" in objects[0]

    def test_audio_with_language(self):
        """Test audio with inLanguage"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Spanish Lesson",
                "inLanguage": "es-ES"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["inLanguage"] == "es-ES"


class TestAudioObjectTranscriptCaption:
    """Test AudioObject transcript and caption fields"""

    def test_audio_with_transcript_url(self):
        """Test audio with transcript URL"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Interview Audio",
                "transcript": "https://example.com/transcripts/interview-123.txt"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["transcript"] == "https://example.com/transcripts/interview-123.txt"

    def test_audio_with_transcript_text(self):
        """Test audio with transcript text"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Short Audio Clip",
                "transcript": "This is the full transcript of the audio content."
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["transcript"] == "This is the full transcript of the audio content."

    def test_audio_with_caption(self):
        """Test audio with caption"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Music Track",
                "caption": "Recorded live at Madison Square Garden, 2024"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["caption"] == "Recorded live at Madison Square Garden, 2024"


class TestAudioObjectRating:
    """Test AudioObject rating and interaction fields"""

    def test_audio_with_aggregate_rating(self):
        """Test audio with aggregateRating"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Popular Podcast Episode",
                "aggregateRating": {
                    "@type": "AggregateRating",
                    "ratingValue": 4.8,
                    "reviewCount": 250
                }
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        # Complex objects are returned as JSON strings per codebase pattern
        assert "aggregateRating" in objects[0]

    def test_audio_with_interaction_statistic(self):
        """Test audio with interactionStatistic"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Viral Audio Clip",
                "interactionStatistic": {
                    "@type": "InteractionCounter",
                    "interactionType": "https://schema.org/ListenAction",
                    "userInteractionCount": 1500000
                }
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["name"] == "Viral Audio Clip"
        # Complex objects are returned as JSON strings per codebase pattern
        assert "interactionStatistic" in objects[0]


class TestAudioObjectRealWorld:
    """Test with real-world AudioObject examples"""

    def test_podcast_episode(self):
        """Test complete podcast episode"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "The Future of AI - Episode 42",
                "description": "In this episode, we discuss the latest developments in artificial intelligence",
                "contentUrl": "https://cdn.example.com/podcasts/ep42.mp3",
                "embedUrl": "https://example.com/player/ep42",
                "duration": "PT1H15M30S",
                "encodingFormat": "audio/mpeg",
                "uploadDate": "2024-11-01T08:00:00Z",
                "datePublished": "2024-11-01",
                "author": {
                    "@type": "Person",
                    "name": "Dr. Tech Expert"
                },
                "publisher": {
                    "@type": "Organization",
                    "name": "Tech Talk Podcast Network"
                },
                "inLanguage": "en-US",
                "image": "https://example.com/podcast-cover.jpg"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        audio = objects[0]
        assert audio["@type"] == "AudioObject"
        assert audio["name"] == "The Future of AI - Episode 42"
        assert audio["contentUrl"] == "https://cdn.example.com/podcasts/ep42.mp3"
        assert audio["duration"] == "PT1H15M30S"
        assert audio["encodingFormat"] == "audio/mpeg"
        assert audio["inLanguage"] == "en-US"

    def test_music_track(self):
        """Test music track AudioObject"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Bohemian Rhapsody",
                "description": "Classic rock song by Queen",
                "contentUrl": "https://music.example.com/tracks/bohemian-rhapsody.mp3",
                "duration": "PT5M55S",
                "encodingFormat": "audio/mpeg",
                "bitrate": "320 kbps",
                "author": {
                    "@type": "Person",
                    "name": "Freddie Mercury"
                },
                "publisher": {
                    "@type": "Organization",
                    "name": "EMI Records"
                },
                "datePublished": "1975-10-31",
                "image": "https://music.example.com/album-art/night-at-opera.jpg",
                "aggregateRating": {
                    "@type": "AggregateRating",
                    "ratingValue": 5.0,
                    "reviewCount": 50000
                }
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        audio = objects[0]
        assert audio["@type"] == "AudioObject"
        assert audio["name"] == "Bohemian Rhapsody"
        assert audio["duration"] == "PT5M55S"
        assert audio["bitrate"] == "320 kbps"
        assert audio["datePublished"] == "1975-10-31"

    def test_audiobook_chapter(self):
        """Test audiobook chapter"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Chapter 1: The Beginning",
                "description": "First chapter of the audiobook",
                "contentUrl": "https://audiobooks.example.com/book123/ch01.mp3",
                "duration": "PT45M",
                "encodingFormat": "audio/mpeg",
                "author": {
                    "@type": "Person",
                    "name": "John Author"
                },
                "publisher": {
                    "@type": "Organization",
                    "name": "Audiobook Publisher Inc"
                },
                "inLanguage": "en-US",
                "transcript": "https://audiobooks.example.com/book123/ch01-transcript.txt"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        audio = objects[0]
        assert audio["@type"] == "AudioObject"
        assert audio["name"] == "Chapter 1: The Beginning"
        assert audio["duration"] == "PT45M"
        assert audio["transcript"] == "https://audiobooks.example.com/book123/ch01-transcript.txt"


class TestAudioObjectComplete:
    """Test complete AudioObject with all fields"""

    def test_audio_complete(self):
        """Test audio with comprehensive field coverage"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Complete Audio Example",
                "description": "An audio file with all metadata",
                "contentUrl": "https://example.com/audio.mp3",
                "embedUrl": "https://example.com/player/embed",
                "url": "https://example.com/listen/audio",
                "duration": "PT30M",
                "encodingFormat": "audio/mpeg",
                "bitrate": "192 kbps",
                "uploadDate": "2024-11-07T12:00:00Z",
                "datePublished": "2024-11-07",
                "author": {
                    "@type": "Person",
                    "name": "Content Creator"
                },
                "publisher": {
                    "@type": "Organization",
                    "name": "Media Company"
                },
                "inLanguage": "en-US",
                "transcript": "https://example.com/transcript.txt",
                "caption": "Recorded in high quality stereo",
                "image": "https://example.com/cover.jpg",
                "aggregateRating": {
                    "@type": "AggregateRating",
                    "ratingValue": 4.5,
                    "reviewCount": 100
                },
                "interactionStatistic": {
                    "@type": "InteractionCounter",
                    "interactionType": "https://schema.org/ListenAction",
                    "userInteractionCount": 10000
                }
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        audio = objects[0]

        assert audio["@type"] == "AudioObject"
        assert audio["name"] == "Complete Audio Example"
        assert audio["description"] == "An audio file with all metadata"
        assert audio["contentUrl"] == "https://example.com/audio.mp3"
        assert audio["embedUrl"] == "https://example.com/player/embed"
        assert audio["url"] == "https://example.com/listen/audio"
        assert audio["duration"] == "PT30M"
        assert audio["encodingFormat"] == "audio/mpeg"
        assert audio["bitrate"] == "192 kbps"
        assert audio["uploadDate"] == "2024-11-07T12:00:00Z"
        assert audio["datePublished"] == "2024-11-07"
        assert audio["inLanguage"] == "en-US"
        assert audio["transcript"] == "https://example.com/transcript.txt"
        assert audio["caption"] == "Recorded in high quality stereo"
        assert audio["image"] == "https://example.com/cover.jpg"
        # Complex objects are present
        assert "author" in audio
        assert "publisher" in audio
        assert "aggregateRating" in audio
        assert "interactionStatistic" in audio


class TestAudioObjectEdgeCases:
    """Test edge cases for AudioObject"""

    def test_audio_empty_optional_fields(self):
        """Test that optional fields can be omitted"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Minimal Audio"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 1
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["name"] == "Minimal Audio"
        # Optional fields should not be present if not provided
        assert "description" not in objects[0]
        assert "duration" not in objects[0]
        assert "uploadDate" not in objects[0]

    def test_audio_in_graph(self):
        """Test AudioObject within @graph"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@graph": [
                    {
                        "@type": "AudioObject",
                        "name": "First Audio"
                    },
                    {
                        "@type": "AudioObject",
                        "name": "Second Audio"
                    }
                ]
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 2
        assert objects[0]["@type"] == "AudioObject"
        assert objects[0]["name"] == "First Audio"
        assert objects[1]["@type"] == "AudioObject"
        assert objects[1]["name"] == "Second Audio"


class TestAudioObjectIntegration:
    """Test AudioObject integration with extract_all()"""

    def test_extract_all_includes_audio(self):
        """Test that extract_all() includes AudioObject"""
        html = """
        <html>
        <head>
            <title>Audio Page</title>
            <meta property="og:title" content="OG Title">
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Test Audio",
                "description": "A test audio file"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        data = meta_oxide.extract_all(html)

        assert "meta" in data
        assert "opengraph" in data
        assert "jsonld" in data

        assert len(data["jsonld"]) == 1
        assert data["jsonld"][0]["@type"] == "AudioObject"
        assert data["jsonld"][0]["name"] == "Test Audio"

    def test_multiple_types_with_audio(self):
        """Test AudioObject alongside other Schema.org types"""
        html = """
        <html>
        <head>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "AudioObject",
                "name": "Audio Content"
            }
            </script>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "Article",
                "headline": "Article Content"
            }
            </script>
        </head>
        <body></body>
        </html>
        """

        objects = meta_oxide.extract_jsonld(html)

        assert len(objects) == 2
        types = [obj["@type"] for obj in objects]
        assert "AudioObject" in types
        assert "Article" in types


if __name__ == "__main__":
    pytest.main([__file__, "-v"])