There is that script for Indesign to import a PDF with more then one page. How to make it adopt the paqe direction in Indesign to either it is a portrait or landscape page in the PDF. In my PDF there both portrait and landscape pages.
I'd be surprised if someone had a script for that. Lacking that, I'd use the script to import all the pages. Then use the Page tool (after import) to change the orientation of pages that need to be landscape.